Last active
March 15, 2017 12:04
-
-
Save herecydev/af366b06e93a1aeacd53f80ebad01633 to your computer and use it in GitHub Desktop.
WebpackMerge array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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