I have a multi-page app. And I have configured multi-entry points with one js file. The reason for making this: these two pages have a lot of the same code. So far, I have already read about webpack-plugins and webpack configuration without any result.
Question: Can I pass some parameter to page1 entry point and page2 entry point in order to my index.js file will resolve what exactly it should do? Is it possible? And could anyone give advice on this issue?
...
entry: {
page1: "./index.js",
page2: "./index.js"
},
...
webpack-hot-middleware/client uses a magic __resourceQuery for the job:
if (__resourceQuery) {
var querystring = require('querystring');
var overrides = querystring.parse(__resourceQuery.slice(1));
setOverrides(overrides);
}
Here, overrides gets the querystring as an object.
Source: https://github.com/glenjamin/webpack-hot-middleware/blob/8984fa2845da68b8b9652669f738d6d49ce8e4b5/client.js#L16-L20
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With