Reputation: 31
I just want to import a custom js module on another js file.
on html head:
<script src="Dictionary.js" type="module"></script>
<script type="text/javascript" src="Templates.js" ></script>
On Module:
var Dictionary=function() {...}
export {Dictionary};
On js File:
import {Dictionary} from './Dictionary';
I get these errors
On Chrome:
Uncaught SyntaxError: Unexpected token {
On Firefox
SyntaxError: import declarations may only appear at top level of a module
The two files are in the same folder.
Upvotes: 1
Views: 1728