May 2018
Intermediate to advanced
470 pages
13h 54m
English
Modify the code to require nodeExternals, and update the config object with the following in your webpack.config.server.js file to configure Webpack for bundling server-side code.
mern-simplesetup/webpack.config.server.js:
const config = { name: "server", entry: [ path.join(CURRENT_WORKING_DIR , './server/server.js') ], target: "node", output: { path: path.join(CURRENT_WORKING_DIR , '/dist/'), filename: "server.generated.js", publicPath: '/dist/', libraryTarget: "commonjs2" }, externals: [nodeExternals()], module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: [ 'babel-loader' ] } ] }}
The mode option is not set here explicitly but will be passed as required when running the Webpack commands with ...
Read now
Unlock full access