restore webpack splitting behavior

This commit is contained in:
Florian Dold 2019-05-08 01:32:33 +02:00
parent 799fe2cc36
commit 3db38fbd0b
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
4 changed files with 26 additions and 7 deletions

View File

@ -44,6 +44,7 @@
"react": "^16.8.5", "react": "^16.8.5",
"react-dom": "^16.8.5", "react-dom": "^16.8.5",
"structured-clone": "^0.2.2", "structured-clone": "^0.2.2",
"terser-webpack-plugin": "^1.2.3",
"through2": "2.0.1", "through2": "2.0.1",
"tslint": "^5.14.0", "tslint": "^5.14.0",
"typedoc": "^0.14.2", "typedoc": "^0.14.2",

View File

@ -150,7 +150,7 @@ export namespace Checkable {
function checkMap(target: any, prop: Prop, path: Path): any { function checkMap(target: any, prop: Prop, path: Path): any {
if (typeof target !== "object") { if (typeof target !== "object") {
throw new SchemaError(`expected object for ${path}, got ${typeof target} instead`); throw new SchemaError(`expected object for ${path}, got ${typeof target} instead`);
} }
for (const key in target) { for (const key in target) {
prop.keyProp.checker(key, prop.keyProp, path.concat([key])); prop.keyProp.checker(key, prop.keyProp, path.concat([key]));
@ -195,7 +195,7 @@ export namespace Checkable {
if (innerProp.optional) { if (innerProp.optional) {
continue; continue;
} }
throw new SchemaError(`Property ${innerProp.propertyKey} missing on ${path} of ${typeName}`); throw new SchemaError(`Property '${innerProp.propertyKey}' missing on '${path}' of '${typeName}'`);
} }
if (!remainingPropNames.delete(innerProp.propertyKey)) { if (!remainingPropNames.delete(innerProp.propertyKey)) {
throw new SchemaError("assertion failed"); throw new SchemaError("assertion failed");

View File

@ -2,6 +2,7 @@ const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const { CheckerPlugin } = require('awesome-typescript-loader') const { CheckerPlugin } = require('awesome-typescript-loader')
const TerserPlugin = require('terser-webpack-plugin');
function externalsCb(context, request, callback) { function externalsCb(context, request, callback) {
@ -17,7 +18,7 @@ module.exports = function (env) {
const base = { const base = {
output: { output: {
filename: '[name]-bundle.js', filename: '[name]-bundle.js',
chunkFilename: "[id].chunk.js", chunkFilename: "[id]-bundle.js",
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, "dist"),
}, },
module: { module: {
@ -43,6 +44,18 @@ module.exports = function (env) {
externalsCb, externalsCb,
"child_process", "child_process",
], ],
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
keep_classnames: true,
keep_fnames: true,
}
}),
],
}
} }
const configWebWorker = { const configWebWorker = {
entry: {"cryptoWorker": "./src/crypto/cryptoWorker.ts"}, entry: {"cryptoWorker": "./src/crypto/cryptoWorker.ts"},
@ -81,9 +94,14 @@ module.exports = function (env) {
name: "pages", name: "pages",
optimization: { optimization: {
splitChunks: { splitChunks: {
name: "page-common", cacheGroups: {
minChunks: 2, commons: {
} name: 'page-common',
chunks: 'all',
minChunks: 2,
},
},
},
}, },
}; };

View File

@ -6086,7 +6086,7 @@ term-size@^1.2.0:
dependencies: dependencies:
execa "^0.7.0" execa "^0.7.0"
terser-webpack-plugin@^1.1.0: terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.2.3:
version "1.2.3" version "1.2.3"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.2.3.tgz#3f98bc902fac3e5d0de730869f50668561262ec8" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.2.3.tgz#3f98bc902fac3e5d0de730869f50668561262ec8"
integrity sha512-GOK7q85oAb/5kE12fMuLdn2btOS9OBZn4VsecpHDywoUC/jLhSAKOiYo0ezx7ss2EXPMzyEWFoE0s1WLE+4+oA== integrity sha512-GOK7q85oAb/5kE12fMuLdn2btOS9OBZn4VsecpHDywoUC/jLhSAKOiYo0ezx7ss2EXPMzyEWFoE0s1WLE+4+oA==