Django中的Javascript模块管理(已关闭)
我正在从事一个项目,该项目有多个包含不同函数的.js文件。 我想在M2.js中使用M1.js中的函数,我正在做的是从M1.js导出函数并在M2.js中导入 导出工作正常,但问题是当我导入函数时Django中的Javascript模块管理(已关闭),javascript,jquery,django,django-staticfiles,django-static,Javascript,Jquery,Django,Django Staticfiles,Django Static,我正在从事一个项目,该项目有多个包含不同函数的.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 t
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'%}
我的目录结构是
-Project
|--project
|--Invoicing (App)
|--static
|--Invoicing
|--M1.js
|--M2.js
|--templates
|--etc
|--static
|--etc
尝试将
index.html
中的基本href更改为当前目录
改变这个
<base href="/">
对此
<base href="./">
问题是我用于导入模块的路径,顺便说一句,感谢您的输入
<base href="./">