3

I am working on a project that has multiple .js file for containing different functions. I want to use the function from M1.js in M2.js and what I am doing is exporting the function from M1.js and importing in M2.js.

The export works fine, but the issue is when I import function.

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'%}

Above is the code that generate following error on import

Loading module from “app.com/static/Invoicing/exif_js” was blocked because of a disallowed MIME type (“text/html”).

My directory structure is

-Project
 |--project
 |--Invoicing (App)
   |--static
     |--Invoicing
       |--M1.js
       |--M2.js
   |--templates
   |--etc
 |--static
 |--etc



Waqar Ali
  • 86
  • 11

1 Answers1

2

Try changing the base href in index.html to the current directory

Change this

<base href="/">

to this

<base href="./">
Naila Akbar
  • 3,033
  • 4
  • 34
  • 76