This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
58 lines (56 loc) · 1.78 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
"use strict";
/* global __dirname */
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
const source = "build/dist";
module.exports = {
resolve: {
modules: [source, "node_modules"],
},
entry: {
// With the move to Webpack 4 we essentially produce only a production
// bundle, which is what we load in Karma.
// salve: "lib/salve/validate.js",
"salve.min": "lib/salve/validate.js",
},
//
// Some stats, as of April 2017,
// in gulp with source-map 17s
// in gulp with eval-source-map 12s
// source-map 10s
// cheap-module-source-map 8s
// eval-source-map 5s
//
// Among the above, source-map and cheap-module-source-map are the only two
// that are appropriate for production. cheap-module-source-map does not
// provide enough of a speed benefit. So we use source-map.
//
// The figures above also explain why gulp spawns webpack rather than run it
// inside the gulp process. ("in gulp" means having gulp load webpack as a
// module and run it there. It effectively runs webpack as part of the gulp
// process whereas spawning runs webpack in a different process.)
//
devtool: "source-map",
output: {
path: `${__dirname}/build/dist`,
filename: "[name].js",
sourceMapFilename: "[name].js.map",
library: "salve",
libraryTarget: "umd",
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
safari10: true,
},
sourceMap: true,
})],
},
plugins: [
// We drop from the bundle everything that is Node-dependent.
new webpack.IgnorePlugin(/\/resource-loaders\/node$/),
new webpack.IgnorePlugin(/\.\/xsl$/, /schema-simplifiers$/),
new webpack.IgnorePlugin(/\.\/(?:jing|xmllint)$/, /schema-validators$/),
],
};