Last active
February 7, 2021 06:43
-
-
Save ericclemmons/40a2783313d157d8b448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require("lodash"); | |
var path = require("path"); | |
var env = process.env.NODE_ENV || "development"; | |
var debug = ["development", "test"].indexOf(env) !== -1; | |
var defaults = { | |
cache: debug, | |
debug: debug, | |
devtool: debug ? "#inline-source-map" : null, | |
entry: {}, | |
env: env, | |
module: { | |
loaders: [ | |
{ test: /\.js$/, loaders: ["babel"], exclude: /node_modules/ }, | |
{ test: /\.json$/, loaders: ["json"] }, | |
], | |
}, | |
output: { | |
chunkFilename: "[name].min.js", | |
devtoolModuleFilenameTemplate: "[absolute-resource-path]", | |
filename: "[name].min.js", | |
libraryTarget: "var", | |
path: path.join(__dirname, "public"), | |
}, | |
plugins: [], | |
target: "web", | |
}; | |
module.exports.defaults = defaults; | |
module.exports.extend = function merge(config) { | |
return _.extend({}, defaults, config); | |
}; | |
module.exports.merge = function merge(config) { | |
return _.merge({}, defaults, config); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var base = require("./webpack.config.base"); | |
var path = require("path"); | |
var webpack = require("webpack"); | |
module.exports = base.merge({ | |
entry: { | |
server: [ | |
path.join(__dirname, "src/server.js"), | |
], | |
}, | |
externals: /^[a-z\-0-9]+$/, // Every non-relative module is external | |
node: { | |
__filename: true, | |
__dirname: true, | |
}, | |
output: { | |
libraryTarget: "commonjs2", | |
path: path.join(__dirname, "src"), | |
}, | |
plugins: [ | |
new webpack.DefinePlugin({ | |
__CLIENT__: false, | |
__SERVER__: true, | |
__STAGE__: "process.env.NODE_ENV || \"development\"", | |
}), | |
], | |
target: "node", | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment