-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Error: "export 'default' (imported as 'ClassicEditor') was not found in '@ckeditor/ckeditor5-build-classic' #2178
Comments
Made a demo repo with a problem |
Hi! Thanks for providing all the steps, we really appreciate that. However, this issue is odd because I assume that the mentioned integration method works for the great majority of people since this is the first report mentioning such a problem. Therefore, I think that there may be something specific in your setup which causes this. I've seen ckeditor/ckeditor5-build-classic#89 and it doesn't change the code semantics. It's still exactly the same code. So there's a question of why it starts to work after this change. Most likely webpack or some other tool treats differently such a way to format an export statement. I did some googling and found this: webpack/webpack#4817 (comment). Maybe you have a similar problem. |
PS. Perhaps we can also change the way how we export this class in |
EDIT: I meant ckeditor/ckeditor5-build-classic#89. |
@Reinmar thank you for replay Changed as you proposed. For now getting another error. Will try to dig it later by comparing any working project with my babel.config.js https://github.com/woto/ckeditor_rails_react/blob/master/babel.config.js |
@Reinmar wow, accidentally i made it works :) woto/ckeditor_rails_react@fcf8f75#diff-4eb01bf0c37b5cc636b6fb94e2ce76bf Sorry i'm not JS master and i may be wrong, but my opinion is that there is a problem in wrong ES6 exporting of ClassicEditor. It is exporting to |
I can see this that this was already causing problems (thanks for pinging us in #776). So, it's not something new. We've got to dive a bit into this and figure out why it sometimes fail. I'm pretty sure that it's something about webpack/babel configuration. |
I seem to be having the same problem with a Rails 6 app. When I follow the instructions to I'm using webpack 4.2.2 via the Rails gem, but not React (as the previous user was). NB If I use the CJS syntax ( |
also having this problem on Rails 6 |
Same. Adding UPDATE: Issue was with Webpacker, this fixed for me. |
I am having this issue with a simple custom build |
hey @poncianodiego, I vaguely remember having some issues months ago with imports so gonna share what worked for me, dont' know if this will help you.. just gonna copy-paste some code here for you to give it a shot... I have rails 6 app that uses react. in package.json I have
and here's my entire component,
|
@AndreiMotinga thanks so mucb for sharing! Exactly; the import should kot assing a name. That did it for me. Instead: |
i struggled for many days but when i saw your comment what you suggested worked fine. import '../../@ckeditor/ckeditor5-build-decoupled-document/build/ckeditor.js' DecoupledEditor
|
for me, it was just import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; and in the tsconfig.base.json the target change from es5 to es6. {
"compileOnSave": false,
"compilerOptions": {
[...],
"target": "es6",
[...]
}
} |
For Rails 6, what worked for me is to do it this way :
This approach doesn't work (Uncaught ReferenceError: ClassicEditor is not defined) :
|
Just another data point...I'm running into this error in a non-Rails Vue.js project. Which means it's not Rails-specific. My custom CKEditor 5 build (https://github.com/audreyfeldroy/ckeditor5-build-writernaut) worked fine until I did an Things that didn't work for me:
What worked for me:
|
I had the same problem. Custom CKEditor5 build, CreateReactApp. When tried to build the react app, it failed with the following: What I needed was to use require instead of import in my component. Now my build is running fine. Edit: |
I've been struggling with this for a day. Everything works fine in development, but not in production build. The problem seems to come from how webpack sees CKEditor's umd module. In development: (function webpackUniversalModuleDefinition(root, factory) {
if (true) module.exports = factory();else {}
})(window, function () { In production: (function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object') module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') exports['CKEditor'] = factory();
else root['CKEditor'] = factory();
})(window, function () { In development, it just assigns it to I tried all sorts of things to make production build able to import this module. I know it's possible, because my Storybook production build sees the module just find. But I just couldn't figure it out. I ended up doing the following hack. My custom CKEditor build goes into import CKEditor, {CKEditorConfig} from './CKEditor-defs';
import './CKEditor.css';
export type {CKEditor, CKEditorConfig};
const CKEditorDirectImport = require('./CKEditor-umd.js');
const CKEditorClass = (
typeof CKEditorDirectImport === 'function'
? CKEditorDirectImport
: window['CKEditor']
) as typeof CKEditor;
export default CKEditorClass; So I sniff whether there is a proper export, and pick it. Otherwise, re-export global value. Not ideal, but it seems to work. |
having a similar issue with my custom build after upgrading to angular 12, before on 11 everything was working fine.
I tried pulling a new custom build and still ran into the same issue. Reviewing #146 & #176 were also no help and still resulted in a "this.editor.create() is not a function" or "Error: [ts] Module './ckeditor-custom/ckeditor'' has no exported member 'ClassicEditor' What ultimately worked for me was chaning my import to: import './ckeditor-custom/ckeditor'; and inside my OnInit method call the ClassicEditor from the window: public editor = window['ClassicEditor']; Very hacky, but it works for now... |
This is still an issue. I cloned the @ckeditor/ckeditor5-classic-build build, added one custom plugin and built the files. The project is a Vue.js project using laravel-mix for webpack stuff. Importing the classic build like this works fine import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; But if I try to import my own build... import ClassicEditor from '../custom-ckeditor-build'; I get export 'default' (imported as 'ClassicEditor') was not found in '../custom-ckeditor-build' (module has no exports) The funny thing is that if I take the custom code that is not working ( |
@robbens how did you solved? |
This works for me: |
My app was using ckeditor5 custom build without issue, however i started having the same issue when i switched from using craco to using vite |
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue. |
This solution works for me.. |
Same issue with custom build ckeditor (VueJS) |
This is still an issue. Instead of |
Online builder sometimes provides the Watchdog component, as it's a recommended setup when you use more complex plugins (like collaboration). In this case, you need to use named imports: import { EditorWatchdog, Editor } from 'ckeditor-custom-build'; |
for anyone still fighting this issue (react + vite), and troubling importing custom build: #12963 (comment) |
Please keep in mind that using predefined or custom builds may not work in the future. The v42.0.0 solved problems related to extending, works flawlessly with Vite, I highly encourage migrating. |
Hi, i've decided to try using ckeditor according with https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/react.html but stucked with error
i've also tried inline version and got similar error.
Have no idea what i am doing wrong. What else may i report to better understand where is the problem? Thank you!
The text was updated successfully, but these errors were encountered: