From: Ulrich-Matthias Schäfer Date: Sun, 13 Jun 2021 22:46:42 +0000 (+0200) Subject: cleaned up config, reduced bundle size by a lot!!! X-Git-Tag: 3.1.0~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e2833b4f2f51278d6e405c95461aa797fe783de;p=svg.js.git cleaned up config, reduced bundle size by a lot!!! --- diff --git a/.config/rollup.config.js b/.config/rollup.config.js index 91ab2cd..8391ba0 100644 --- a/.config/rollup.config.js +++ b/.config/rollup.config.js @@ -24,18 +24,17 @@ const getBabelConfig = (node = false) => { let targets = pkg.browserslist const plugins = [ - ['@babel/plugin-transform-classes'], - ['@babel/plugin-transform-runtime', { - corejs: 3, - helpers: true, - useESModules: true, + ['@babel/transform-runtime', { version: "^7.14.5", - regenerator: false + regenerator: false, + useESModules: true + }], + ["polyfill-corejs3", { + "method": "usage-pure" }] ] if (node) { - plugins.shift() targets = 'maintained node versions' } @@ -43,14 +42,15 @@ const getBabelConfig = (node = false) => { include: 'src/**', babelHelpers: 'runtime', babelrc: false, + targets: targets, presets: [['@babel/preset-env', { modules: false, - targets: targets || pkg.browserslist, // useBuildins and plugin-transform-runtime are mutually exclusive // https://github.com/babel/babel/issues/10271#issuecomment-528379505 // use babel-polyfills when released useBuiltIns: false, - bugfixes: true + bugfixes: true, + loose: true }]], plugins }) @@ -110,7 +110,7 @@ const config = (node, min, esm = false) => ({ plugins: [ resolve({ browser: !node }), commonjs(), - getBabelConfig(node && 'maintained node versions'), + getBabelConfig(node), filesize(), !min ? {} : terser({ mangle: { @@ -120,8 +120,7 @@ const config = (node, min, esm = false) => ({ preamble: headerShort } }) - ], - // external: [/@babel\/runtime/, /@babel\/runtime-corejs3/]//['@babel/runtime', '@babel/runtime-corejs3'] + ] }) // [node, minified, esm] diff --git a/package-lock.json b/package-lock.json index 0c8861e..06c5e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1271,15 +1271,6 @@ "@babel/plugin-proposal-optional-chaining": "^7.14.5" } }, - "@babel/plugin-external-helpers": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-external-helpers/-/plugin-external-helpers-7.14.5.tgz", - "integrity": "sha512-q/B/hLX+nDGk73Xn529d7Ar4ih17J8pNBbsXafq8oXij0XfFEA/bks+u+6q5q04zO5o/qivjzui6BqzPfYShEg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, "@babel/plugin-proposal-async-generator-functions": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.14.5.tgz", @@ -2057,24 +2048,6 @@ "@babel/helper-plugin-utils": "^7.14.5" } }, - "@babel/polyfill": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.12.1.tgz", - "integrity": "sha512-X0pi0V6gxLi6lFZpGmeNa4zxtwEmCs42isWLNjZZDE0Y8yVfgu0T2OAHlzBbdYlqbW/YXVvoBHpATEM+goCj8g==", - "dev": true, - "requires": { - "core-js": "^2.6.5", - "regenerator-runtime": "^0.13.4" - }, - "dependencies": { - "core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "dev": true - } - } - }, "@babel/preset-env": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.5.tgz", @@ -2196,16 +2169,6 @@ "regenerator-runtime": "^0.13.4" } }, - "@babel/runtime-corejs3": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.5.tgz", - "integrity": "sha512-cBbwXj3F2xjnQJ0ERaFRLjxhUSBYsQPXJ7CERz/ecx6q6hzQ99eTflAPFC3ks4q/IG4CWupNVdflc4jlFBJVsg==", - "dev": true, - "requires": { - "core-js-pure": "^3.14.0", - "regenerator-runtime": "^0.13.4" - } - }, "@babel/template": { "version": "7.8.6", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", @@ -4340,12 +4303,6 @@ } } }, - "core-js-pure": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.14.0.tgz", - "integrity": "sha512-YVh+LN2FgNU0odThzm61BsdkwrbrchumFq3oztnE9vTKC4KS2fvnPmcx8t6jnqAyOTCTF4ZSiuK8Qhh7SNcL4g==", - "dev": true - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -9059,7 +9016,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } diff --git a/package.json b/package.json index 335528b..2f0decc 100644 --- a/package.json +++ b/package.json @@ -78,13 +78,8 @@ }, "devDependencies": { "@babel/core": "^7.14.5", - "@babel/plugin-external-helpers": "^7.14.5", - "@babel/plugin-transform-classes": "^7.14.5", "@babel/plugin-transform-runtime": "^7.14.5", - "@babel/polyfill": "^7.12.1", "@babel/preset-env": "^7.14.5", - "@babel/runtime": "^7.14.5", - "@babel/runtime-corejs3": "^7.14.5", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "^19.0.0", "@rollup/plugin-multi-entry": "^4.0.0", @@ -115,13 +110,8 @@ "rollup-plugin-terser": "^7.0.2", "typescript": "^4.3.2", "yargs": "^17.0.1", - "svgdom": "^0.1.8" + "svgdom": "^0.1.8", + "babel-plugin-polyfill-corejs3": "^0.2.2" }, - "browserslist": [ - "last 2 version", - "> 0.25%", - "not ie 11", - "not dead" - ], - "dependencies": {} + "browserslist": "last 2 version and > 0.25% and not op_mini all and not ie 11" }