From a83f6c8d1ebc2df56dd6e81054a258d67fb742f9 Mon Sep 17 00:00:00 2001 From: Jakub Niezgoda Date: Thu, 1 Aug 2019 13:58:58 +0200 Subject: [PATCH] Changed UMD version of package to be ES5 compatible (addition for CY-1473) --- package-lock.json | 10 ++++++++++ package.json | 1 + rollup.config.js | 10 ++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index e51a2c6..1e9af48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7341,6 +7341,16 @@ "acorn": "^6.1.1" } }, + "rollup-plugin-babel": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz", + "integrity": "sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "rollup-pluginutils": "^2.8.1" + } + }, "rollup-plugin-commonjs": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.0.1.tgz", diff --git a/package.json b/package.json index c9e991f..5dce97e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "jest": "^24.8.0", "prettier": "^1.18.2", "rollup": "^1.16.7", + "rollup-plugin-babel": "^4.3.3", "rollup-plugin-commonjs": "^10.0.1", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-terser": "^5.1.1" diff --git a/rollup.config.js b/rollup.config.js index 6f67666..80ee9a3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,10 +1,11 @@ import resolve from 'rollup-plugin-node-resolve'; +import babel from 'rollup-plugin-babel'; import commonjs from 'rollup-plugin-commonjs'; import { terser } from 'rollup-plugin-terser'; import pkg from './package.json'; export default [ - // browser-friendly UMD build + // browser-friendly UMD build - ES5 { input: 'src/index.js', output: { @@ -13,7 +14,12 @@ export default [ format: 'umd', sourcemap: true }, - plugins: [resolve(), commonjs(), terser()] + plugins: [ + resolve(), + commonjs(), + babel({ presets: ['@babel/preset-env'], exclude: 'node_modules/**' }), + terser() + ] }, // CommonJS (for Node) and ES module (for bundlers) build.