-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.prod.js
42 lines (39 loc) · 870 Bytes
/
webpack.prod.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
const path = require("path");
const webpack = require("webpack");
const uglifyPlugin = require("uglifyjs-webpack-plugin");
const BUILD_DIR = path.resolve(__dirname, "build");
const SRC_DIR = path.resolve(__dirname, "src");
const ENTRY_PATH = path.resolve(SRC_DIR, "LruCache.js");
module.exports = {
mode: "production",
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: "production",
DEBUG: false,
}),
],
entry: {
index: ENTRY_PATH,
},
output: {
path: BUILD_DIR,
filename: "lru-cache.js",
libraryTarget: "commonjs2",
},
module: {
rules: [
{
test: /\.js/,
include: [SRC_DIR],
use: ["babel-loader", "eslint-loader"],
},
],
},
resolve: {
extensions: [".js"],
},
optimization: {
minimize: true,
minimizer: [new uglifyPlugin({include: /\.js/})],
},
};