-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.js
46 lines (44 loc) · 1007 Bytes
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var webpack = require("webpack");
var pkg = require("./package.json");
var path = require("path");
var StringReplacePlugin = require("string-replace-webpack-plugin");
var config = {
entry: {
"persist": "./src/Persist.js"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
library: [pkg.namespace.eg, "Persist"],
libraryTarget: "umd",
libraryExport: "default",
umdNamedDefine: true
},
externals: [],
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{
test: /(\.js)$/,
loader: StringReplacePlugin.replace({
replacements: [{
pattern: /#__VERSION__#/ig,
replacement: function (match, p1, offset, string) {
return pkg.version;
}
}]
})
}]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new StringReplacePlugin()
]
};
module.exports = function (env) {
env = env || "development";
return require("./config/webpack.config." + env + ".js")(config);
};