Skip to content

Commit b7e3a4a

Browse files
committed
webpack
1 parent 2dc2ba4 commit b7e3a4a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

config/webpack.config.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const webpack = require("webpack");
2+
const path = require("path");
3+
const BabiliPlugin = require("babili-webpack-plugin");
4+
const CleanWebpackPlugin = require("clean-webpack-plugin");
5+
6+
module.exports = {
7+
entry: path.resolve(__dirname, "../index.js"),
8+
output: {
9+
path: path.resolve(__dirname, "../build"),
10+
filename: "mathsteps.min.js",
11+
libraryTarget: "umd",
12+
library: "mathsteps"
13+
},
14+
externals: {
15+
mathjs: "mathjs"
16+
},
17+
module: {
18+
rules: [
19+
{
20+
test: /\.js$/,
21+
exclude: [/node_modules/, /scripts/, /test/, /Config/],
22+
use: ["babel-loader"]
23+
}
24+
]
25+
},
26+
plugins: [
27+
new webpack.LoaderOptionsPlugin({ // Options for loader that will run on files
28+
minimize: true,
29+
debug: false,
30+
options: {
31+
context: __dirname
32+
}
33+
}),
34+
new webpack.optimize.ModuleConcatenationPlugin(), // Webpack 3 (scope hoisting)
35+
new webpack.optimize.UglifyJsPlugin(), // Minifier
36+
new webpack.DefinePlugin({ // Production ready build
37+
"process.env": {
38+
NODE_ENV: JSON.stringify("production")
39+
}
40+
}),
41+
new CleanWebpackPlugin([path.resolve(__dirname, "../build")]) // Prebuild (kinda hook)
42+
]
43+
};

0 commit comments

Comments
 (0)