diff --git a/package.json b/package.json index e7bf6dd..f71c7b8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ }, "main": "dist/a-iterable.js", "module": "dist/a-iterable.mjs", - "esm5": "dist/a-iterable.esm5.js", "typings": "index.d.ts", "dependencies": { "call-thru": "^2.5.2", diff --git a/rollup.config.js b/rollup.config.js index 4f0c6e1..2d0a7d5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,43 +4,12 @@ import sourcemaps from 'rollup-plugin-sourcemaps'; import typescript from 'rollup-plugin-typescript2'; import pkg from './package.json'; -const mainConfig = makeConfig( - baseConfig('tsconfig.main.json'), - { - output: { - format: 'cjs', - file: pkg.main, - }, - }); - -const esmConfig = makeConfig( - baseConfig('tsconfig.es6.json'), - { - output: { - file: pkg.module, - }, - }); - -const esm5Config = makeConfig( - baseConfig('tsconfig.es5.json'), - { - output: { - file: pkg.esm5, - }, - }); - -function makeConfig(baseConfig, ...configs) { - return configs.reduce( - (prev, config) => ({ - ...prev, - ...config, - plugins: [ ...(prev.plugins || []), ...(config.plugins || []) ], - output: { ...(prev.output || {}), ...(config.output || {}) }, - }), - baseConfig); -} +export default [ + makeConfig({ tsconfig: 'tsconfig.module.json', file: pkg.module, format: 'esm' }), + makeConfig({ tsconfig: 'tsconfig.main.json', file: pkg.main, format: 'cjs' }), +]; -function baseConfig(tsconfig) { +function makeConfig({ tsconfig, file, format }) { return { plugins: [ commonjs(), @@ -56,14 +25,9 @@ function baseConfig(tsconfig) { input: './src/index.ts', external: Object.keys(pkg.dependencies), output: { - format: 'esm', + file, + format, sourcemap: true, }, }; } - -export default [ - mainConfig, - esmConfig, - esm5Config, -] diff --git a/tsconfig.es5.json b/tsconfig.es5.json deleted file mode 100644 index cc74078..0000000 --- a/tsconfig.es5.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.main.json", - "compilerOptions": { - "target": "es5", - "downlevelIteration": true - } -} diff --git a/tsconfig.es6.json b/tsconfig.module.json similarity index 100% rename from tsconfig.es6.json rename to tsconfig.module.json