forked from nanjingboy/nvmw
-
Notifications
You must be signed in to change notification settings - Fork 16
/
webpack.config.js
61 lines (57 loc) · 1.52 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
52
53
54
55
56
57
58
59
60
61
"use strict";
const Path = require("path");
const webpack = require("webpack");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const base = {
mode: "production",
devtool: "source-map",
entry: {
"nvm.js": Path.resolve("lib/cli.js")
},
plugins: [
new webpack.BannerPlugin({
banner: "#!/usr/bin/env node",
raw: true
}),
process.env.ANALYZE_BUNDLE && new BundleAnalyzerPlugin()
].filter(x => x),
resolve: {
symlinks: false, // don't resolve symlinks to their real path
alias: {
xml2js: Path.resolve("stubs/xml2js.js"),
"iconv-lite": Path.resolve("stubs/iconv-lite.js"),
"./iconv-loader": Path.resolve("stubs/iconv-loader.js"),
debug: Path.resolve("stubs/debug.js"),
lodash: require.resolve("lodash/lodash.min.js"),
"resolve-from": Path.resolve("stubs/resolve-from.js"),
bluebird: Path.resolve("stubs/bluebird")
}
},
output: {
filename: `[name]`,
path: Path.resolve("dist"),
libraryTarget: "commonjs2"
},
target: "node",
node: {
__filename: false,
__dirname: false
}
};
const node10 = Object.assign({}, base, {
module: {
rules: [
{
test: /\.js$/,
exclude: x => x.indexOf("node_modules") > 0,
use: {
loader: "babel-loader",
options: {
presets: [["@babel/env", { targets: { node: "10.16.0" } }]]
}
}
}
]
}
});
module.exports = node10;