IXBS
1
0
I’m trying to install Editor.js using node.js package in my hello-express Glitch project. This is the package via NPM:
npm i @editorjs/editorjs --save
I included the module in my javascript file as mentioned in the Editor.js documentation:
import EditorJS from '@editorjs/editorjs';
const editor = new EditorJS();
But the following error appears in the browser console:
Uncaught SyntaxError: Cannot use import statement outside a module
I’m sure it’s a bad installation in my Glitch project but I don’t know how to fix it. Could you help me?
That isn’t a installation issue. import statements can only be used in modules. Try this instead:
<script type="module">
import EditorJS from '@editorjs/editorjs';
const editor = new EditorJS();
</script>
This turns it into a module.
Wow, I had no idea about the type attr. Are there docs on this?
1 Like
<script type="script"> would make for a bad attribute value ngl
Modules in client side - this is getting interesting ![:thinking: :thinking:](https://emoji.discourse-cdn.com/apple/thinking.png?v=9)
Yeah like monaco editor where you have to link to the modules in node_modules folder
1 Like
system
Closed
8
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.