-
Notifications
You must be signed in to change notification settings - Fork 38
/
production.config.js
33 lines (32 loc) · 1008 Bytes
/
production.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
/**
* Common Production Config
*
* @param {import("../JsConfigWebpackPlugin.js").JsConfigWebpackPluginOptions} options
* @returns {{ module: { rules : Array<any> }, plugins: Array<(new (): any)>, optimization: { minimizer: Array<(new (): any)>} }}
*/
exports = module.exports = (options) => ({
module: {
rules: [
{
test: /\.(js|jsx|mjs)$/,
exclude: [/[/\\\\]node_modules[/\\\\]/], // exclude node_modules folder per default
use: [
// run process in multiple threads
require.resolve('thread-loader'),
{
loader: require.resolve('babel-loader'),
options: {
extends: options.babelConfigFile,
// cache builds, future builds attempt to read from cache to avoid needing to run expensive babel processings
cacheDirectory: true,
// do not include superfluous whitespace characters and line terminators
// https://babeljs.io/docs/en/babel-core/#options
compact: true,
},
},
],
},
],
},
plugins: [],
});