Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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