forked from Code2Life/http-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
43 lines (42 loc) · 1.06 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
const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const version = require("./package.json").version;
module.exports = {
entry: "./src/main.ts",
devtool: "source-map",
target: "node",
node: false,
mode: "production",
plugins: [
new CleanWebpackPlugin("./dist"),
new webpack.EnvironmentPlugin({
NODE_ENV: "production"
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false
})
],
module: {
rules: [{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/
}]
},
// for ws module, these two cpp dependencies are optional, ignore them
externals: ["bufferutil", "utf-8-validate"],
resolve: {
extensions: [".ts", ".js", ".json", ".node"]
},
optimization: {
minimize: true,
nodeEnv: "production",
},
output: {
filename: `http-adapter-${version}.js`,
path: path.resolve(__dirname, "./dist")
}
};