Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with CKEditorError: ckeditor-duplicated-modules after updating to CKEditor 42.0.0 #16624

Closed
w-beom opened this issue Jun 27, 2024 · 11 comments
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:question This issue asks a question (how to...).

Comments

@w-beom
Copy link

w-beom commented Jun 27, 2024

After updating CKEditor to version 42.0.0, I encounter the following error when bundling with UMD: Uncaught CKEditorError: ckeditor-duplicated-modules. There are no plugins being called twice.

Below is the configuration file I used:

import {
    ClassicEditor as ClassicEditorBase,
    Alignment,
    AutoImage,
    Autoformat,
    AutoLink,
    BlockQuote,
    Bold,
    CKFinder,
    Code,
    CodeBlock,
    Essentials,
    FindAndReplace,
    Font,
    GeneralHtmlSupport,
    Heading,
    HeadingButtonsUI,
    HorizontalLine,
    HtmlEmbed,
    ImageCaption,
    ImageInsert,
    ImageResize,
    ImageStyle,
    ImageToolbar,
    ImageBlock,
    Image,
    ImageEditing,
    IndentBlock,
    Indent,
    Italic,
    LinkImage,
    Link,
    ListProperties,
    List,
    MediaEmbedToolbar,
    MediaEmbed,
    PageBreak,
    Paragraph,
    ParagraphButtonUI,
    PasteFromOffice,
    RemoveFormat,
    SelectAll,
    SimpleUploadAdapter,
    SourceEditing,
    SpecialCharactersArrows,
    SpecialCharactersCurrency,
    SpecialCharactersEssentials,
    SpecialCharactersLatin,
    SpecialCharactersMathematical,
    SpecialCharactersText,
    SpecialCharacters,
    StandardEditingMode,
    Strikethrough,
    Subscript,
    Superscript,
    TableCaption,
    TableCellProperties,
    TableColumnResize,
    TableProperties,
    TableToolbar,
    Table,
    TextTransformation,
    Title,
    TodoList,
    Underline,
    Mention,
    TextPartLanguage
} from 'ckeditor5'

import {
    DocumentOutline,
    FormatPainter,
    PasteFromOfficeEnhanced,
    SlashCommand,
    TableOfContents,
    CaseChange,
    Template
} from 'ckeditor5-premium-features'

export default class ClassicEditor extends ClassicEditorBase {
}

ClassicEditor.builtinPlugins = [

    Essentials, 
    Autoformat, 
    Heading,  
    HeadingButtonsUI, 
    Paragraph,  
    ParagraphButtonUI, 
    Bold,
    Code,
    Italic,
    Strikethrough,
    Subscript,
    Superscript,
    Underline,
    Font,   
    BlockToolbar, 
    Link,
    List,
    ListProperties,
    CodeBlock,
    BlockQuote,
    Indent,
    IndentBlock,
    SourceEditing,
    TableCaption,
    TableCellProperties,
    TableColumnResize,
    TableProperties,
    TableToolbar,
    Table,
    Alignment, 
    HorizontalLine,
    SelectAll, 
    Link,
    AutoLink,
    MediaEmbed,
    MediaEmbedToolbar,
    PasteFromOffice,
    Image,
    LinkImage,
    ImageEditing,
    AutoImage
    PageBreak, 
    TextTransformation, 
    RemoveFormat, 
    FindAndReplace, 
    TodoList,
    SimpleUploadAdapter,
    ImageCaption,
    ImageInsert,
    ImageToolbar,
    ImageResize,
    ImageStyle,
    ImageBlock,
    SpecialCharacters,
    SpecialCharactersArrows,
    SpecialCharactersCurrency,
    SpecialCharactersEssentials,
    SpecialCharactersLatin,
    SpecialCharactersMathematical,
    SpecialCharactersText,
    HtmlEmbed,
    Mention,
    TextPartLanguage,
    DocumentOutline,
    FormatPainter,
    PasteFromOfficeEnhanced,
    SlashCommand,
    TableOfContents,
    CaseChange,
    Template
];
@w-beom w-beom added the type:question This issue asks a question (how to...). label Jun 27, 2024
@filipsobol
Copy link
Member

Hi @w-beom 👋. This problem can be caused by old packages (in a different version) still being installed.

Can you share the dependencies from your package.json file?

@w-beom
Copy link
Author

w-beom commented Jun 27, 2024

Hi @filipsobol Here is the package.json:

{
  "main": "./build/ckeditor.js",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "author": "",
  "devDependencies": {
    "ckeditor5": "^42.0.0",
    "ckeditor5-premium-features": "^42.0.0",
    "vite": "^5.3.1"
  }
}

@filipsobol
Copy link
Member

Unfortunately this doesn't seem enough to find the cause of this issue. My guess would be some other other imports from @ckeditor/ckeditor5-* or ckeditor5/src/*.

Could you prepare a minimal reproduction that we can use to debug this, please?

@ogsmith
Copy link

ogsmith commented Jun 28, 2024

Hi! We're also trying to solve for this:

We've downgraded back to 42.1.2, our dependencies are the same as the below, and we remove package-lock.json but some sub dependencies are upgrading themselves to 42

"@ckeditor/ckeditor5-alignment": "41.2.1",
"@ckeditor/ckeditor5-basic-styles": "41.2.1",
"@ckeditor/ckeditor5-build-classic": "41.2.1",
"@ckeditor/ckeditor5-editor-classic": "41.2.1",
"@ckeditor/ckeditor5-essentials": "41.2.1",
"@ckeditor/ckeditor5-font": "41.2.1",
"@ckeditor/ckeditor5-heading": "41.2.1",
"@ckeditor/ckeditor5-horizontal-line": "41.2.1",
"@ckeditor/ckeditor5-html-embed": "41.2.1",
"@ckeditor/ckeditor5-image": "41.2.1",
"@ckeditor/ckeditor5-link": "41.2.1",
"@ckeditor/ckeditor5-media-embed": "41.2.1",
"@ckeditor/ckeditor5-paragraph": "41.2.1",
"@ckeditor/ckeditor5-react": "6.2.0",
"@ckeditor/ckeditor5-theme-lark": "41.2.1",
"@ckeditor/ckeditor5-upload": "41.2.1",
"@ckeditor/vite-plugin-ckeditor5": "0.1.3",

@CKEditorBot CKEditorBot removed the pending:feedback This issue is blocked by necessary feedback. label Jun 29, 2024
@w-beom
Copy link
Author

w-beom commented Jun 30, 2024

Oh, I'm sorry. The issue was caused by the import statement in the custom plugin I created. I referred to the custom plugin documentation and fixed it. The issue no longer occurs. Thank you, everyone.

@w-beom w-beom closed this as completed Jun 30, 2024
@Witoso Witoso added the resolution:resolved This issue was already resolved (e.g. by another ticket). label Jul 1, 2024
@jjroelofs
Copy link

@w-beom Hi, I'm having the same problem and cannot find the documentation related to fixing it. Can you help me out? :)
I tried installing some other random plugin "ckeditor5-diagrams" to compare and it generates the same error.

@filipsobol
Copy link
Member

Hi @jjroelofs. Have you seen our updated documentation for the ckeditor-duplicated-modules error? https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-ckeditor-duplicated-modules

@jjroelofs
Copy link

jjroelofs commented Oct 19, 2024

@filipsobol Yes I have. We are building the plugin on a Custom Package Generator project that we cloned a couple of months ago, so it's on CKEditor 43. Our plugin works fine using yarn run start and yarn run dll:serve. When loading it in a simple custom build we run into problem.

I didn't study the docs in-depth to be honest, maybe I'll have another go at it next week.

Our plugin has 83 imports in source, and I'm not the main developer, so it's a bit tiring to debug. Would be great if the error could tell us what plugins are duplicated.

@jjroelofs
Copy link

@filipsobol ok I managed by matching the major version after all. Now my next problem is: Drupal 10.3 is on CKEditor 41. My plugin is on 43 and loading it in a 41 environment triggers the duplicate plugin error. How do I produce a release for 41? My project was built on the CK43 Plugin Generator.
I'll create a new issue if I can't figure it out.

@filipsobol
Copy link
Member

I'm not sure if I can help more without some example. Could you create a new issue and provide a minimal reproduction?

@amitjangid12
Copy link

amitjangid12 commented Oct 30, 2024

Hi @w-beom, I get this error when I use a custom plugin, how to solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:resolved This issue was already resolved (e.g. by another ticket). type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

7 participants