Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

How to resolve "Uncaught SyntaxError: Cannot use import statement outside a module"?

$
0
0

I want to setup editor.js in my Django project but it's not working (I mean the text editor in not coming through) Then I've tried in a simple HTML and JS file to check it but text editor is not coming in here too. I've run through the console and it's saying

editor.js:1 Uncaught SyntaxError: Cannot use import statement outside a module

"

I've followed the documentation to install this --

npm init -y npm i @editorjs/editorjs --save-dev

Link for the guide: https://editorjs.io/getting-started

Here is my HTML

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Document</title><link rel="stylesheet" href="css/main.css"></head><body><h1> text editor </h1><div id="editorjs"></div><button> save </button><script  src="editor.js"></script></body></html>

and here is my JS code

import EditorJs from '@editorjs/editorjs';


const editor = new EditorJs({

});

Can you help me to solve this problem!! thank you


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>