Skip to content
Advertisement

Webpack ES6 modules multiple class app organization

I’m building an app with webpack for the first time and i’m trying to wrap my head around organizing class files. I’m having trouble getting the code to work. I’m still new to ES6 and such, so my code below is probably very wrong but i’m not sure its my approach/concept or its my syntax.

entry is index.js and I also have these files

JavaScript

src/js/app.js the main global method/variable class

JavaScript

src/js/user.js methods that are for users

JavaScript

src/js/guest.js methods that are for guests

JavaScript

src/js/cookie.js cookie manipulating methods

JavaScript

src/js/database.js firebase methods

JavaScript

Advertisement

Answer

You are trying to access instance property statically. You need to create an instance of App class before trying to access cookieStore property. You can create an instance and export it in your app.js to have singleton instance.

JavaScript

in other files

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement