-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (47 loc) · 1.09 KB
/
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
47
48
49
50
51
"use strict";
const Path = require("path");
const webpack = require("webpack");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const base = {
mode: process.env.ANALYZE_BUNDLE ? "development" : "production",
//devtool: "source-map",
entry: {
"card.js": Path.resolve("src/card.js")
},
plugins: [
process.env.ANALYZE_BUNDLE && new BundleAnalyzerPlugin()
].filter(x => x),
resolve: {
symlinks: false, // don't resolve symlinks to their real path
alias: {
"term-size": Path.resolve("stubs/term-size.js")
}
},
output: {
filename: `[name]`,
path: Path.resolve("dist"),
libraryTarget: "commonjs2"
},
target: "node",
node: {
__filename: false,
__dirname: false
}
};
const node6 = Object.assign({}, base, {
module: {
rules: [
{
test: /\.js$/,
exclude: x => x.indexOf("node_modules") > 0,
use: "babel-loader"
}
]
},
output: {
filename: `node6-[name]`,
path: Path.resolve("dist"),
libraryTarget: "commonjs2"
}
});
module.exports = [base, node6];