chore: tweak size script

This commit is contained in:
Evan You 2019-09-20 00:31:14 -04:00
parent 3ddd121b19
commit 30e60c0492
3 changed files with 6 additions and 5 deletions

View File

@ -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"
},

View File

@ -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 => {

View File

@ -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' }
)