Reputation: 309
So basically i want to improve my code readability on webpack.
I try to split the entry point so it looks like this.
entry : {
dashboard : ["./scripts/monuments.js", "./scripts/dashboard.js"]
}
And it will be resulting in dashboard-bundled.js
The question is, how i can get the variable from the monuments.js to use in dashboard.js? Do i need to export it? Or can you guys perhaps suggest a better way to split the entry point?
Upvotes: 0
Views: 72
Reputation: 6824
how i can get the variable from the monuments.js to use in dashboard.js? Do i need to export it?
Yes, you must export them in order to use them in different modules by using import statements.
can you guys perhaps suggest a better way to split the entry point?
You want to bundle your third party code into one separate bundle as these don't change often, and your application code in a different module, that way you can take advantage of browser long term caching of the vendor code which you don't want the clients to download everytime they make a request because if something doesn't change, the browsers will just fetch from its cache (better for you and the users)
Upvotes: 1