-
Notifications
You must be signed in to change notification settings - Fork 29
/
webpack.config.babel.js
45 lines (44 loc) · 1 KB
/
webpack.config.babel.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
import webpack from "webpack";
import path from "path";
import BabiliPlugin from "babili-webpack-plugin";
const SOURCE = path.join(__dirname, "src");
const DESTINATION = path.join(__dirname, "dist");
const ENV = process.env.NODE_ENV;
const isDebug = ENV === "development";
const mode = "production";
export default {
context: __dirname,
entry: {
index: "./src",
},
mode: mode,
output: {
path: DESTINATION,
publicPath: ".",
filename: "[name].js",
chunkFilename: "[name]-[chunkhash].js",
libraryTarget: "umd",
},
module: {
rules: [
{
test: SOURCE,
use: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.dat$/,
use: "binary-loader",
exclude: /node_modules/,
},
],
},
devtool: isDebug ? "inline-sourcemap" : false,
plugins: isDebug
? []
: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new BabiliPlugin(),
],
};