Files
getting-started/nodejs/react-cypress-launchdarkly-feature-flag-test/webpack.config.server.js
Arpendu Kumar Garai 3930e1cb03 Test and Automate Features behind the Flags using Cypress Tests (#206)
* nodejs cypress test launchdarkly

* Delete README.md

* refactor code

* refactor code

* code cleanup

Co-authored-by: Arpendu Kumar Garai <Arpendu.KumarGarai@microfocus.com>
2022-11-07 19:51:48 +11:00

28 lines
1.1 KiB
JavaScript

const path = require('path');
const nodeExternals = require('webpack-node-externals');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: ['@babel/polyfill', './src/server/server.js'], // set this to your server entry point. This should be where you start your express server with .listen()
target: 'node', // tell webpack this bundle will be used in nodejs environment.
externals: [nodeExternals()], // Omit node_modules code from the bundle. You don't want and don't need them in the bundle.
output: {
path: path.resolve('dist'),
filename: 'serverBundle.js',
libraryTarget: 'commonjs2', // IMPORTANT! Add module.exports to the beginning of the bundle, so universal-hot-reload can access your app.
},
// The rest of the config is pretty standard and can contain other webpack stuff you need.
module: {
rules: [
{
test: /\.jsx?$/,
include: path.resolve('src'),
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}],
},
};