Is there a way to create both 'web' and 'node' versions of a bundle with one go by using Webpack or Browserify? The 'web' version of the bundle will be used on a client, and 'node' version of the same bundle will be used on the server for pre-rendering ("isomorphic" web application).
I think the easiest way is probably just to create two configs, one with target: "node" and the other target: "web" in the configuration, and run them both like $ webpack && webpack --config webpack.config.web.js
You can create multiple config objects in webpack.config.js file:
const config1 = {
target: 'web',
...
}
const config2 = {
target: 'node',
...
}
export default [config1, config2]
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