I've been trying to get a grip on imports and exports so that I can slim down my JS application. I've tried incorporating these Mozilla and this Stack Overflow examples without any luck. It looks like Chrome should support this now. I'm not sure what I'm doing wrong.
I have a function like this in export.js:
export crossingover() {
dynamicText.setText('Some text');
canvas.renderAll();
}
I import the above in my main app.js file like this, where the original function was:
import { crossingover } from 'export';
In my index.html file I have the two script tags:
<script src="app.js"></script>
<script type="module" src="export.js"></script>
In my mind, the result should be the same as having the original function where the import now is in app.js but it breaks the application. What am I missing?
I'm getting these 2 errors when I inspect my application:
Uncaught SyntaxError: Unexpected token {
index.html:1 Access to Script at 'file:///myappdirectory/export.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.