Skip to content

[Bug]: relative imports fail due to CLI install #4971

@fonty422

Description

@fonty422

Bug type

Crash (process/app exits or hangs)

Browser surface

No

Summary

It seems like the default shadcn CLI install fails to create the plugins directory.

Public reproduction URL

No response

Steps to reproduce

Install as per docs using shadcn CLI and then attempt to use anything that requires items from the plugins directory.

Expected behavior

A ./plugins directory should be created and files correctly added there.

This might be a similar issue to the shadcn CLI issue not allowing aliases for registries, so please let me know if we need to bug shadcn about these issues.

Actual behavior

The main issue is that the default import for some kits (like editor-base-kit) hard-code the import to use plugins:

import { BaseAlignKit } from './plugins/align-base-kit';
import { BaseBasicBlocksKit } from './plugins/basic-blocks-base-kit';
import { BaseBasicMarksKit } from './plugins/basic-marks-base-kit';
import { BaseCalloutKit } from './plugins/callout-base-kit';
import { BaseCodeBlockKit } from './plugins/code-block-base-kit';
import { BaseColumnKit } from './plugins/column-base-kit';
import { BaseCommentKit } from './plugins/comment-base-kit';
import { BaseDateKit } from './plugins/date-base-kit';
import { BaseFootnoteKit } from './plugins/footnote-base-kit';
import { BaseFontKit } from './plugins/font-base-kit';
import { BaseLineHeightKit } from './plugins/line-height-base-kit';
import { BaseLinkKit } from './plugins/link-base-kit';
import { BaseListKit } from './plugins/list-base-kit';
import { MarkdownKit } from './plugins/markdown-kit';
import { BaseMathKit } from './plugins/math-base-kit';
import { BaseMediaKit } from './plugins/media-base-kit';
import { BaseMentionKit } from './plugins/mention-base-kit';
import { BaseSuggestionKit } from './plugins/suggestion-base-kit';
import { BaseTableKit } from './plugins/table-base-kit';
import { BaseTocKit } from './plugins/toc-base-kit';
import { BaseToggleKit } from './plugins/toggle-base-kit';

export const BaseEditorKit = [
  ...BaseBasicBlocksKit,
  ...BaseCodeBlockKit,
  ...BaseTableKit,
  ...BaseToggleKit,
  ...BaseTocKit,
  ...BaseMediaKit,
  ...BaseCalloutKit,
  ...BaseColumnKit,
  ...BaseMathKit,
  ...BaseDateKit,
  ...BaseLinkKit,
  ...BaseMentionKit,
  ...BaseBasicMarksKit,
  ...BaseFontKit,
  ...BaseListKit,
  ...BaseAlignKit,
  ...BaseLineHeightKit,
  ...BaseCommentKit,
  ...BaseSuggestionKit,
  ...MarkdownKit,
  ...BaseFootnoteKit,
];

This makes it hard to upgrade anything as it will override any manual changes.
If we move the required files to a plugins directory, it will also duplicate these on upgrade.

Acceptance criteria

Ideally, I would like to have the plate items in a subdirectory of the shadcn default directory, but that also requires manual moving will end up with duplicate shadcn components as well as make upgrading plate items difficult.

If a manual install will resolve all of these issues, please let me know and we will go down that path instead and write our own docs for devs on how to install safely for updates.

Plate / Slate / React versions

plate: 53.0.3
shadcn: 4.7.0

Operating system

windows, but will run prod on linux

Install method

npx with shadcn CLI

Framework / app setup

Vite

Affected packages or entry points

@plate/

Minimal code or config excerpt

import { FixedToolbarKit } from '@/components/ui/fixed-toolbar-kit';

Logs, screenshots, and evidence

8:54:12 am [vite] Internal server error: Failed to resolve import "./plugins/basic-blocks-base-kit" from "src/components/editor-base-kit.tsx". Does the file exist?
  Plugin: vite:import-analysis

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions