diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 752ebc1..0000000 --- a/.babelrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "plugins": [ - - ], - "presets": [ - ["@babel/preset-env", { - "modules" : false, - "targets": { - "browsers": ["IE 9"] - } - }] - ], - "env": { - "production": { - "plugins" : [ - ["transform-remove-console", { "exclude": [ "error", "warn"] }] - ] - } - } -} \ No newline at end of file diff --git a/.babelrc.js b/.babelrc.js new file mode 100644 index 0000000..02b7491 --- /dev/null +++ b/.babelrc.js @@ -0,0 +1,23 @@ +module.exports = { + "plugins": [], + "presets": [ + ["@babel/preset-env", { + "modules" : false, + "targets": { + "browsers": ["IE 9"] + } + }] + ], + "env": { + "production": { + "plugins" : [ + ["babel-plugin-transform-remove-console", { "exclude": [ "error", "warn"] }] + ] + }, + "staging": { + "plugins" : [ + ["babel-plugin-transform-remove-console", { "exclude": [ "error", "warn"] }] + ] + } + } +} \ No newline at end of file diff --git a/example/index.html b/example/index.html index 8db9439..c3aa26a 100644 --- a/example/index.html +++ b/example/index.html @@ -2,7 +2,7 @@
- + diff --git a/package.json b/package.json index 7d472a5..6cf7dc6 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,10 @@ "dev": "npm run watch", "watch": "npm run build:polyfill && chokidar-cmd -c \"npm run build:polyfill\" -t src/*.js", "cs": "prettier --write src/*.js", - "build:polyfill": "rollup -c", - "build": "npm run cs && BABEL_ENV=production npm run build:polyfill" + "build:dev": "rollup -c", + "build:prod": "BABEL_ENV=production rollup -c", + "build:staging" : "BABEL_ENV=staging rollup -c", + "build": "npm run cs && npm run build:dev && npm run build:prod && npm run build:staging" }, "author": "", "license": "ISC", diff --git a/rollup.config.js b/rollup.config.js index ec50b73..372d5bf 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,7 +4,7 @@ import uglify from "rollup-plugin-uglify"; export default { input: `src/polyfill.js`, output: { - file: `dist/preload-polyfill.js`, + file: `dist/preload-polyfill${process.env.BABEL_ENV === 'production' ? '.min' : process.env.BABEL_ENV === 'staging' ? '' : '.dev'}.js`, format: "iife", name: `preload_polyfill` },