I'm trying to export an Object from a .js file to another one. Actually I found many bits of help but with Node.js, and I'm not using it.
Do you think it's possible to do it without Node.js?
I've tried something :
//file1.js
var MyObject = {
property: value
};
export{MyObject};
//file2.js
import MyObject from 'file2.js';
This code gives me some errors :
- Uncaught SyntaxError: Unexpected token 'export'
- Uncaught SyntaxError: Cannot use import statement outside a module
EDIT : I've found another way to do what I was looking for without using the export method, thanks to the helpers !
--experimental-modules