我正在开发一个具有多个 .js 文件以包含不同功能的项目。我想在 M2.js 中使用来自 M1.js 的函数,我正在做的是从 M1.js 导出函数并在 M2.js 中导入。
导出工作正常,但问题是当我导入函数时。
M1.js
--export {function}
M2.js
--import {function} from './M1.js'
<script type="module" href="{% static 'myapp/M1.js'%}
<script type="module" href="{% static 'myapp/M2.js'%}
以上是在导入时生成以下错误的代码
Loading module from “app.com/static/Invoicing/exif_js” was blocked because of a disallowed MIME type (“text/html”).
我的目录结构是
-Project
|--project
|--Invoicing (App)
|--static
|--Invoicing
|--M1.js
|--M2.js
|--templates
|--etc
|--static
|--etc