From 05c50d70d5e420daba351af2423ead6aa8fc862a Mon Sep 17 00:00:00 2001 From: bigopon Date: Tue, 12 Apr 2022 19:56:37 +1000 Subject: [PATCH] chore(build): add es2017 format --- build/scripts/build.js | 13 +++++++++++++ build/scripts/dev.js | 21 ++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/build/scripts/build.js b/build/scripts/build.js index 570aeaa..0eb1317 100644 --- a/build/scripts/build.js +++ b/build/scripts/build.js @@ -67,6 +67,19 @@ function build() { }), ] }, + { + input: `src/${LIB_NAME}.ts`, + output: [ + { file: `dist/es2017/${LIB_NAME}.js`, format: 'es', sourcemap: true } + ], + external: externalLibs, + plugins: [ + typescript({ + target: 'es2017', + removeComments: true + }), + ] + }, { input: `src/${LIB_NAME}.ts`, output: [ diff --git a/build/scripts/dev.js b/build/scripts/dev.js index 3aaee41..1ff7a4b 100644 --- a/build/scripts/dev.js +++ b/build/scripts/dev.js @@ -3,23 +3,34 @@ const args = require('../tasks/args'); const rollup = require('rollup'); const typescript = require('@rollup/plugin-typescript').default; const ChildProcess = require('child_process'); +const pkg = require('../../package.json'); +const { name } = pkg; const targetFormats = args.format || ['commonjs']; // by default only run devs for commonjs const targetDir = args.target; const buildConfigs = { - es: { + es2015: { output: { - file: 'dist/es2015/index.js', + file: `dist/es2015/${name}.js`, format: 'es' }, tsConfig: { target: 'es2015' } }, + es2017: { + output: { + file: `dist/es2017/${name}.js`, + format: 'es' + }, + tsConfig: { + target: 'es2017' + } + }, amd: { output: { - file: 'dist/amd/index.js', + file: `dist/amd/${name}.js`, format: 'amd', amd: { id: 'aurelia-router' } }, @@ -29,7 +40,7 @@ const buildConfigs = { }, commonjs: { output: { - file: 'dist/commonjs/index.js', + file: `dist/commonjs/${name}.js`, format: 'cjs' }, tsConfig: { @@ -38,7 +49,7 @@ const buildConfigs = { }, 'native-modules': { output: { - file: 'dist/commonjs/index.js', + file: `dist/native-modules/${name}.js`, format: 'es' }, tsConfig: {