Skip to content

Instantly share code, notes, and snippets.

@herecydev
Last active March 15, 2017 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herecydev/af366b06e93a1aeacd53f80ebad01633 to your computer and use it in GitHub Desktop.
Save herecydev/af366b06e93a1aeacd53f80ebad01633 to your computer and use it in GitHub Desktop.
WebpackMerge array
let clientConfig = {
entry: "./src/website/js/App.tsx"
}
let serverConfig = {
entry: "./src/server/server.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "server.js",
},
target: "node"
};
}
module.exports = [clientConfig, serverConfig];
const config = require("./webpack.base.js");
const webpackMerge = require("webpack-merge");
let clientConfig = {
devtool: "source-map",
output: {
filename: "[name].js"
}
}
//Just need to alter the client config here
module.exports = webpackMerge(config, [clientConfig]);
//But we want the exports to still be an array, i.e. has both the altered client config AND the unaltered server config
const config = require("./webpack.base.js");
const webpackMerge = require("webpack-merge");
let clientConfig = {
devtool: "source-map",
output: {
filename: "[name].js"
}
}
//Not the cleanest, but works correctly!
module.exports = [webpackMerge(config[0], clientConfig), config[1]];
const config = require("./webpack.base.js");
const webpackMerge = require("webpack-merge");
let clientConfig = {
output: {
filename: "[name].[chunkhash].js" //some production chunk/hash magic
}
}
//Not DRY
module.exports = [webpackMerge(config[0], clientConfig), config[1]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment