-
Notifications
You must be signed in to change notification settings - Fork 54
/
webpack.config.js
45 lines (37 loc) · 957 Bytes
/
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
const webpack = require("webpack");
const pkg = require("./package.json");
const PROD = process.env.PROD;
const TerserPlugin = require("terser-webpack-plugin");
const banner = [
pkg.name + " - " + pkg.description,
"@version v" + pkg.version,
"@link " + pkg.homepage,
"@author " + pkg.author,
"@contributors " + pkg.contributors,
"@license " + pkg.license,
].join("\n");
module.exports = {
mode: "production",
entry: __dirname + "/src/index.js",
devtool: "source-map",
output: {
library: pkg.name,
path: __dirname + "/build",
filename: PROD ? "typeset.min.js" : "typeset.js",
},
optimization: {
minimizer: [new TerserPlugin()],
},
externals: {
cheerio: "jQuery", // TODO I think there should be another way to avoid require cheerio
jquery: "jQuery",
},
plugins: [
new webpack.BannerPlugin(banner),
new webpack.DefinePlugin({
ENV: {
browser: true,
},
}),
],
};