-
Notifications
You must be signed in to change notification settings - Fork 322
/
webpack.config.js
117 lines (106 loc) · 3.53 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var $webpack = require("webpack");
var $path = require("path");
var $UglifyJsPlugin = require("uglifyjs-webpack-plugin");
var $ChunkIdPlugin = require("webpack-hashed-chunk-id-plugin");
module.exports = function (info) {
return {
entry: info.entry,
devtool: false,
output: {
path: $path.resolve(info.baseDir),
publicPath: (info.runtimeDir != null ? info.runtimeDir: info.baseDir),
filename: "[name].js",
hashFunction: "sha256",
chunkFilename: "deps/[name].js",
jsonpFunction: info.jsonpFunction || "am4internal_webpackJsonp",
libraryTarget: "var",
pathinfo: !info.minify
},
stats: "errors-only",
/*stats: {
// Examine all modules
maxModules: Infinity,
// Display bailout reasons
optimizationBailout: true,
// TODO this is needed to suppress harmless warnings from ts-loader
warningsFilter: /export .* was not found in/
},*/
plugins: [
new $webpack.optimize.ModuleConcatenationPlugin(),
new $webpack.optimize.CommonsChunkPlugin({
names: info.baseChunk,
//chunks: Object.keys(info.entry).filter(function (x) { return x !== "maps"; }),
minChunks: 2,
}),
new $webpack.HashedModuleIdsPlugin({
hashFunction: "sha256"
}),
new $webpack.BannerPlugin({
raw: true,
banner:
`/**
* @license
* Copyright (c) 2018 amCharts (Antanas Marcelionis, Martynas Majeris)
*
* This sofware is provided under multiple licenses. Please see below for
* links to appropriate usage.
*
* Free amCharts linkware license. Details and conditions:
* https://github.com/amcharts/amcharts4/blob/master/LICENSE
*
* One of the amCharts commercial licenses. Details and pricing:
* https://www.amcharts.com/online-store/
* https://www.amcharts.com/online-store/licenses-explained/
*
* If in doubt, contact amCharts at [email protected]
*
* PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE.
* @hidden
*/
`
}),
new $webpack.SourceMapDevToolPlugin({
filename: "[file].map[query]",
exclude: info.excludeSourceMap,
}),
].concat(
(info.minify ? [
new $UglifyJsPlugin({
cache: true,
sourceMap: true,
parallel: true,
uglifyOptions: {
output: {
comments: /@license/,
}
}
})
] : []),
).concat([
new $ChunkIdPlugin({}),
]),
module: {
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
rules: [{
test: /\.js$/,
include: /node_modules[\/\\](?:d3-|tinyqueue)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-syntax-dynamic-import"]
}
}
}, {
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"]
}]
},
externals: info.externals || [
"jsdom",
"xmldom",
"canvas"
]
};
}