Skip to content

Instantly share code, notes, and snippets.

@ovpv
Created August 3, 2019 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovpv/94550425e98d2a4e1022fc0ab4de61e9 to your computer and use it in GitHub Desktop.
Save ovpv/94550425e98d2a4e1022fc0ab4de61e9 to your computer and use it in GitHub Desktop.
Webpack config for React SSR
const path = require("path");
module.exports = [
{
entry: {
client: "./src/client/index.js"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
},
{
target: "node",
entry: {
server: "./src/server.js"
},
node: {
dns: "mock",
fs: "empty",
path: true,
url: false,
net: "empty"
},
output: {
path: path.resolve(__dirname),
filename: "[name].js"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment