Reputation: 9413
There's the library I load with npm: @ckeditor/ckeditor5-build-classic. It works. I can use by
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
After that I pull the target file (it's specified in package.json as ./build/ckeditor.js) and put it outside of node_modules to the project's root.
I try to use it by
import ClassicEditor from './ckeditor'
But it does not work. The error is
"export 'default' (imported as 'ClassicEditor') was not found in 'ckeditor'
Why so? There's no export default
construction indeed, but it works somehow from node_modules. How to make it work outside of node_modules?
Upvotes: 1
Views: 1253
Reputation: 31161
To make CKEditor work in the <script type="module">
element, type:
import {} from './ckeditor.js'
or, simply:
import './ckeditor.js'
Upvotes: 3