]> source.dussan.org Git - svg.js.git/commitdiff
cleaned up config, reduced bundle size by a lot!!!
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>
Sun, 13 Jun 2021 22:46:42 +0000 (00:46 +0200)
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>
Sun, 13 Jun 2021 22:46:42 +0000 (00:46 +0200)
.config/rollup.config.js
package-lock.json
package.json

index 91ab2cdc4030dab4e09e4fe48c8b7f87cf246916..8391ba0b268cacdce075a99e613b10c96c22e1f4 100644 (file)
@@ -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]
index 0c8861ec2d76446aa708aff245d5c3b20a311f57..06c5e7a6e4a67208bd8e6cee96400fd7f2381555 100644 (file)
         "@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",
         "@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",
         "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",
         }
       }
     },
-    "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",
       "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
         }
index 335528b17fdd62a4d14eeff098782a5032d8289a..2f0decc6d347e952e780892a2dc5362067cb7adf 100644 (file)
   },
   "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",
     "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"
 }