Exporting from one file index.js like this: export const categoriesObj = new Object();
and trying to import from another index.js file like this: import { categoriesObj } from "../app/index.js";
, but I get an Uncaught ReferenceError: (variable from the other file) is not defined because instead of just importing the categoriesObj, I think is importing the whole file.
Currently I'm using webpack and babel. Both index.js files have separate bundle files. The folder structure looks like this:
What I have tried is:
What I'm trying to do is to import an object which is generated in another file so I can use it on this other file. Hope this makes sense. I've been stuck in this for days. Thanks for reading!