I am trying to export a module to another js file but I can’t see to make this work for some reason.
My root folder looks like this: root > css, img, js, sass and some html files. Within the js folder I have two js files: app.js and Data.js
This is how I am trying to do the export: export const data = [1, 2, 3, 4, 5];
from the Data.js file. As for the import: import {data} from './Data.js';
to the app.js file.
When I try to console.log(data);
I get an error in the console: “Unexpected token {”
What am I missing here?
edit: import {data} from './Data';
this doesn’t work either…