ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.58k stars 3.7k forks source link

Error "ckeditor-duplicated-modules" - What Are the Alternatives to Importing from src? #17237

Open NikoEscobar opened 1 month ago

NikoEscobar commented 1 month ago

πŸ“ Ask a Question

Description

I recently upgraded my React project to use the latest version of CKEditor, migrating from version 40.1 to 43.2. Along with this, I switched from Webpack to Vite and adopted the new CKEditor installation methods. However, I am facing issues with custom plugins in my project.

These plugins use classes and function helpers from the CKEditor table source. After the migration, I now encounter the following error:
ckeditor-duplicated-modules

I read in the documentation that we can import specific files from the dist directory, but I haven't been able to locate the following imports in the dist path:

import TableWalker from '@ckeditor/ckeditor5-table/src/tablewalker';
import {
  sumArray,
  getColumnEdgesIndexes,
  getElementWidthInPixels,
  getTableWidthInPixels,
  toPrecision,
  getDomCellOuterWidth,
  clamp,
  getColumnGroupElement,
  getTableColumnsWidths
} from '@ckeditor/ckeditor5-table/src/tablecolumnresize/utils';

My Question

Given how my custom plugin is structured, am I unable to migrate to the new installation methods? Or are there alternatives I can pursue to resolve the issue?

Any guidance or suggestions would be appreciated.

Witoso commented 1 month ago

Sorry for keeping you waiting. This is a topic we are discussing internally, and we will publish some detailed messaging soon. Long story short, our Typescript release introduced import indexes (v37), and v42 release introduced tighter APIs as the editor is prebuilt in a bundler. As everything was available historically in src, we are quite surprised sometimes what was used by integrators. We need to figure out what to export and what keep internal to not have too many breaking changes in the future.

We will try to add exports you need in the next release and I will keep you posted if we included everything. Meanwhile, code copy would be the only sufficient method, unfortunately.