react-ssr-boilerplate/webpack.server.js
2024-04-12 19:00:45 -04:00

33 lines
916 B
JavaScript

const path = require('path');
module.exports = {
// Tell webpack that we're building a bundle for Node.js, rather than for the browser
target: 'node',
// Tell webpack the root file of our server application
entry: './src/index.js',
// Tell webpack where to put the output file that is generated
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build')
},
// Tell webpack to run babel on every file it runs through
module: {
rules: [
{
test: /\.js?$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: [
'react',
'stage-0',
['env', { targets: { browsers: ['last 2 versions'] }}]
]
}
}
]
}
};