Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created June 3, 2018 08:00
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 krainboltgreene/d148974e8869ef122cc2292464773b80 to your computer and use it in GitHub Desktop.
Save krainboltgreene/d148974e8869ef122cc2292464773b80 to your computer and use it in GitHub Desktop.
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