问题描述
我正在尝试将editor.js安装到我的项目中,但是,我仍然遇到错误Uncaught SyntaxError: Cannot use import statement outside a module
。
我可以通过CDN加载它,但是由于某种原因,它无法正常工作。
以下是我到目前为止已完成的故障排除步骤:
我已经搜索了stackoverflow,但除此之外找不到其他解决方案。有什么建议吗?
HTML文件:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<Meta charset="utf-8">
<title></title>
</head>
<body>
<div id="editorjs"></div>
<script src="index.js"></script>
</body>
</html>
JS文件:
import EditorJS from '@editorjs/editorjs';
const editor = new EditorJS();
打包JSON文件:
{
"name": "editor","version": "1.0.0","type": "module","description": "","main": "index.js","scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},"keywords": [],"author": "","license": "ISC","devDependencies": {
"@editorjs/editorjs": "^2.18.0"
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)