Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const path = require("path");
const WebpackNodeExternals = require('webpack-node-externals')
const commonConfiguration = {
mode: process.env.NODE_ENV || "development",
}
const moduleBabel = {
test: /index\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
}
}
module.exports = [
{
...commonConfiguration,
entry: "./source/client/index.js",
target: "web",
output: {
path: path.resolve(__dirname, "tmp"),
filename: "client.js"
},
module: {
rules: [
moduleBabel
]
}
},
{
...commonConfiguration,
entry: "./source/server/index.js",
target: "node",
externals: [
WebpackNodeExternals()
],
output: {
path: path.resolve(__dirname, "tmp"),
filename: "server.js",
libraryTarget: "commonjs2"
},
module: {
rules: [
moduleBabel
]
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.