-
-
Notifications
You must be signed in to change notification settings - Fork 572
/
webpack.config.js
65 lines (64 loc) · 1.7 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
62
63
64
65
const nodeExternals = require("webpack-node-externals");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
const path = require("path");
const LicenseCheckerWebpackPlugin = require("license-checker-webpack-plugin");
module.exports = {
entry: {
index: "./dist/index.js",
"adaptors/pg": "./dist/adaptors/pg.js",
},
output: {
path: path.resolve(__dirname, "release/dist"),
filename: "[name].js",
library: {
name: "dataplan_pg",
type: "umd",
},
globalObject: "this",
},
plugins: [
new webpack.DefinePlugin({
"process.env.GRAPHILE_ENV": JSON.stringify("production"),
}),
new LicenseCheckerWebpackPlugin({
allow: "(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT OR 0BSD)",
ignore: [
"@graphile/*",
"@graphile-contrib/*",
"@grafast/*",
"@dataplan/*",
"@localrepo/*",
"graphile-config",
],
emitError: true,
outputFilename: "LICENSES.txt",
// Fix issue with scoped npm modules
filter:
/(^.*[/\\]node_modules[/\\]((?:@[^/\\]+[/\\])?(?:[^@/\\][^/\\]*)))/,
}),
],
target: "node", // use require() & use NodeJs CommonJS style
externalsPresets: {
node: true, // in order to ignore built-in modules like path, fs, etc.
},
externals: [
// in order to ignore all modules in node_modules folder
nodeExternals(),
nodeExternals({
modulesDir: path.resolve(__dirname, "../../node_modules"),
}),
],
performance: {
maxEntrypointSize: 215000,
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
keep_classnames: true,
},
}),
],
},
};