diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-07 14:05:27 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-07 14:05:27 +0100 |
commit | 0cae4172fa0c7ee9b876b1cf2b38ea8be66d3584 (patch) | |
tree | 027e656a664d0ed450026259bba7975b68e59889 /rollup.config.js | |
parent | a0b13ebcacfd74b9f521110c7225bb404325bcd3 (diff) | |
download | svg.js-0cae4172fa0c7ee9b876b1cf2b38ea8be66d3584.tar.gz svg.js-0cae4172fa0c7ee9b876b1cf2b38ea8be66d3584.zip |
remove other builds because of bloat for now until fixed
Diffstat (limited to 'rollup.config.js')
-rw-r--r-- | rollup.config.js | 181 |
1 files changed, 136 insertions, 45 deletions
diff --git a/rollup.config.js b/rollup.config.js index ca9f3df..aaee0e4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,6 +1,9 @@ import babel from 'rollup-plugin-babel' import { uglify } from "rollup-plugin-uglify" +import uglifyEs6 from "rollup-plugin-uglify-es" import filesize from 'rollup-plugin-filesize' +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' const pkg = require('./package.json') const buildDate = Date() @@ -18,48 +21,136 @@ const headerLong = `/*! var headerShort = `/*! ${pkg.name} v${pkg.version} ${pkg.license}*/;` -export default [{ - input: 'src/svg.js', - output: { - file: 'dist/svg.js', - name: 'SVG', - sourceMap: true, - format: 'iife', - banner: headerLong - }, - plugins: [ - babel({ - include: 'src/**' - }), - filesize(), - ] -}, { - input: 'src/main.js', - output: { - file: 'dist/svg.es6.js', - name: 'SVG', - sourceMap: true, - format: 'esm', - banner: headerLong - }, - plugins: [ - babel({ - include: 'src/**' - }) - ] -}, { - input: 'src/svg.js', - output: { - file: 'dist/svg.min.js', - name: 'SVG', - sourceMap: true, - format: 'iife', - banner: headerShort - }, - plugins: [ - babel({ - include: 'src/**' - }), - uglify(), - ] -}] +// const baseConfig = { +// input: 'src/svg.js', +// output: { +// // file: 'dist/svg.js', +// name: 'SVG', +// sourceMap: true, +// // format: 'iife', +// // banner: headerLong +// }, +// plugins: [ +// // babel({ +// // include: 'src/**' +// // }), +// // filesize(), +// ] +// } +// +// const createConfig = (file = 'dist/svg.js', format = 'iife', minify = false) => { +// const config = JSON.parse(JSON.stringify(baseConfig)) +// config.output.file = file +// config.output.format = format +// config.output.banner = minify ? headerShort : headerLong +// +// config.plugins.push(resolve({browser: true})) +// config.plugins.push(commonjs()) +// +// if (format == 'esm') { +// config.plugins.push( +// babel({ +// runtimeHelpers: true, +// include: 'src/**', +// babelrc: false, +// presets: [["@babel/preset-env", { +// "modules": false, +// targets: { +// chrome: 49, +// edge: 14, +// firefox: 45, +// safari: 10 +// }, +// useBuiltIns: "usage" +// }]], +// "plugins": [ +// [ +// "@babel/plugin-transform-runtime", +// { +// "corejs": 2, +// "helpers": true, +// "regenerator": true, +// "useESModules": true +// } +// ] +// ] +// }) +// ) +// } else { +// config.plugins.push( +// babel({ +// include: 'src/**', +// runtimeHelpers: true, +// babelrc: false, +// presets: [ +// ["@babel/preset-env", { +// modules: false, +// targets: { +// ie: "9" +// }, +// useBuiltIns: "entry" +// }] +// ], +// plugins: [ +// [ +// "@babel/plugin-transform-runtime", +// { +// corejs: false, +// helpers: true, +// regenerator: true, +// useESModules: true +// } +// ] +// ] +// }) +// ) +// } +// +// if (minify) { +// config.plugins.push(format == 'esm' ? uglifyEs6() : uglify()) +// } else { +// config.plugins.push(filesize()) +// } +// +// return config +// } + +export default [ + //createConfig('dist/svg.js', 'iife', false), + // createConfig('dist/svg.min.js', 'iife', true), + // createConfig('dist/svg.es6.js', 'esm', false), + // createConfig('dist/svg.es6.min.js', 'esm', true) + { + input: 'src/svg.js', + output: { + file: 'dist/svg.js', + name: 'SVG', + sourceMap: true, + format: 'iife', + banner: headerLong + }, + plugins: [ + // resolve({browser: true}), + // commonjs(), + babel({ + include: 'src/**', + runtimeHelpers: true, + babelrc: false, + presets: [["@babel/preset-env", { + modules: false, + // targets: { + // firefox: "63" + // }, + // useBuiltIns: "usage" + }]], + // plugins: [["@babel/plugin-transform-runtime", { + // corejs: false, + // helpers: true, + // regenerator: true, + // useESModules: true + // }]] + }), + filesize() + ] + } +] |