April 2020
Intermediate to advanced
716 pages
18h 55m
English
Modify the code to require nodeExternals, and update the config object with the following code in your webpack.config.server.js file to configure Webpack for bundling server-side code:
mern-simplesetup/webpack.config.server.js:
const nodeExternals = require('webpack-node-externals')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 ...
Read now
Unlock full access