Uncaught SyntaxError: Cannot use import statement outside a module (at login.html:51:5)
时间: 2023-10-14 14:26:41 浏览: 77
node.js手册中文版
4星 · 用户满意度95%
This error occurs when you try to use an import statement in a script that is not a module.
To fix this error, you need to ensure that the script that contains the import statement is a module. You can do this by adding the `type="module"` attribute to the script tag, like this:
```
<script type="module" src="your-script.js"></script>
```
If you're using ES6 modules, you should also make sure that your server is configured to serve files with the `.mjs` extension with the `Content-Type: application/javascript` MIME type.
阅读全文