diff --git a/package.json b/package.json index 87b05445..f8c0b617 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "node scripts/dev.js", "build": "node scripts/build.js", - "size": "node scripts/build.js runtime-dom -f esm-browser", + "size": "node scripts/build.js runtime-dom -p -f esm-browser && node scripts/build.js compiler-dom -p -f esm-browser", "lint": "prettier --write --parser typescript 'packages/**/*.ts'", "test": "jest" }, diff --git a/rollup.config.js b/rollup.config.js index b1f23b70..0753353e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -53,9 +53,9 @@ const configs = { const defaultFormats = ['esm', 'cjs'] const inlineFromats = process.env.FORMATS && process.env.FORMATS.split(',') const packageFormats = inlineFromats || packageOptions.formats || defaultFormats -const packageConfigs = packageFormats.map(format => - createConfig(configs[format]) -) +const packageConfigs = process.env.PROD_ONLY + ? [] + : packageFormats.map(format => createConfig(configs[format])) if (process.env.NODE_ENV === 'production') { packageFormats.forEach(format => { diff --git a/scripts/build.js b/scripts/build.js index 59c0fa1e..704ebdb0 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -55,7 +55,8 @@ async function build(target) { `NODE_ENV:production,` + `TARGET:${target}` + (formats ? `,FORMATS:${formats}` : ``) + - (args.types ? `,TYPES:true` : ``) + (args.types ? `,TYPES:true` : ``) + + (args.p ? `,PROD_ONLY:true` : ``) ], { stdio: 'inherit' } )