Optimize build

This commit is contained in:
schmelczerandras 2020-09-16 22:02:25 +02:00
parent 935d3796b0
commit dfaaa08433
3 changed files with 8 additions and 27 deletions

View file

@ -2,16 +2,16 @@
"name": "sdf-2d", "name": "sdf-2d",
"version": "0.0.0", "version": "0.0.0",
"scripts": { "scripts": {
"clean": "shx rm -rf _bundles lib lib-esm",
"start": "shx rm -rf lib/* && webpack --watch", "start": "shx rm -rf lib/* && webpack --watch",
"build": "npm run clean && tsc && tsc -m es6 --outDir lib-esm && webpack" "build": "shx rm -rf lib/* && webpack --production"
}, },
"keywords": [], "keywords": [],
"author": "András Schmelczer", "author": "András Schmelczer",
"browserslist": [ "browserslist": [
"defaults" "defaults"
], ],
"main": "lib/sdf-2d.js", "main": "lib/main.js",
"sideEffects": false,
"types": "lib/src/main.d.ts", "types": "lib/src/main.d.ts",
"files": [ "files": [
"lib" "lib"
@ -19,7 +19,6 @@
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.10.1", "@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1", "@typescript-eslint/parser": "^3.10.1",
"awesome-typescript-loader": "^5.2.1",
"eslint": "^7.9.0", "eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0", "eslint-plugin-import": "^2.22.0",
@ -28,7 +27,6 @@
"gl-matrix": "^3.3.0", "gl-matrix": "^3.3.0",
"prettier": "^2.1.2", "prettier": "^2.1.2",
"raw-loader": "^4.0.1", "raw-loader": "^4.0.1",
"resolve-url-loader": "^3.1.1",
"shx": "^0.3.2", "shx": "^0.3.2",
"terser-webpack-plugin": "^2.3.8", "terser-webpack-plugin": "^2.3.8",
"ts-loader": "^8.0.3", "ts-loader": "^8.0.3",

View file

@ -2,7 +2,6 @@
"compilerOptions": { "compilerOptions": {
"outDir": "lib", "outDir": "lib",
"sourceMap": true, "sourceMap": true,
"noImplicitAny": false,
"target": "es5", "target": "es5",
"downlevelIteration": true, "downlevelIteration": true,
"allowJs": true, "allowJs": true,
@ -10,7 +9,7 @@
"strict": true, "strict": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "Node", "moduleResolution": "Node",
"module": "commonjs", "module": "es6",
"declaration": true, "declaration": true,
"composite": true, "composite": true,
"declarationMap": true, "declarationMap": true,

View file

@ -11,9 +11,9 @@ const isDevelopment = !isProduction;
module.exports = { module.exports = {
entry: { entry: {
'sdf-2d': [PATHS.entryPoint], main: [PATHS.entryPoint],
'sdf-2d.min': [PATHS.entryPoint],
}, },
target: 'web',
output: { output: {
path: PATHS.bundles, path: PATHS.bundles,
filename: '[name].js', filename: '[name].js',
@ -31,26 +31,10 @@ module.exports = {
}, },
optimization: { optimization: {
minimize: true, minimize: true,
usedExports: true,
minimizer: [ minimizer: [
new TerserJSPlugin({ new TerserJSPlugin({
sourceMap: isDevelopment, test: /\.js$/i,
cache: true,
test: /\.ts$/i,
terserOptions: {
ecma: 5,
warnings: true,
parse: {},
compress: { defaults: true },
mangle: true,
module: false,
output: null,
toplevel: true,
nameCache: null,
ie8: false,
keep_classnames: false,
keep_fnames: false,
safari10: false,
},
}), }),
], ],
}, },