mirror of https://github.com/vuejs/core.git
workflow: add dev build mode for benchmark
This commit is contained in:
parent
abd685d7f4
commit
30583b9ee1
|
@ -21,6 +21,7 @@ const {
|
|||
port: portStr,
|
||||
count: countStr,
|
||||
noHeadless,
|
||||
devBuild,
|
||||
},
|
||||
} = parseArgs({
|
||||
allowNegative: true,
|
||||
|
@ -58,6 +59,10 @@ const {
|
|||
noHeadless: {
|
||||
type: 'boolean',
|
||||
},
|
||||
devBuild: {
|
||||
type: 'boolean',
|
||||
short: 'd',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -87,10 +92,11 @@ async function buildLib() {
|
|||
cwd: path.resolve(import.meta.dirname, '..'),
|
||||
stdio: 'inherit',
|
||||
}
|
||||
const BuildOptions = devBuild ? '-df' : '-pf'
|
||||
const [{ ok }, { ok: ok2 }, { ok: ok3 }, { ok: ok4 }] = await Promise.all([
|
||||
exec(
|
||||
'pnpm',
|
||||
'run --silent build shared compiler-core compiler-dom compiler-vapor -pf cjs'.split(
|
||||
`run --silent build shared compiler-core compiler-dom compiler-vapor ${BuildOptions} cjs`.split(
|
||||
' ',
|
||||
),
|
||||
options,
|
||||
|
@ -102,12 +108,12 @@ async function buildLib() {
|
|||
),
|
||||
exec(
|
||||
'pnpm',
|
||||
'run --silent build vue-vapor -pf esm-browser'.split(' '),
|
||||
`run --silent build vue-vapor ${BuildOptions} esm-browser`.split(' '),
|
||||
options,
|
||||
),
|
||||
exec(
|
||||
'pnpm',
|
||||
'run --silent build vue -pf esm-browser-runtime'.split(' '),
|
||||
`run --silent build vue ${BuildOptions} esm-browser-runtime`.split(' '),
|
||||
options,
|
||||
),
|
||||
])
|
||||
|
@ -128,17 +134,19 @@ async function buildApp(isVapor) {
|
|||
const CompilerSFC = await import(
|
||||
'../packages/compiler-sfc/dist/compiler-sfc.cjs.js'
|
||||
)
|
||||
const prodSuffix = devBuild ? '.js' : '.prod.js'
|
||||
|
||||
/** @type {any} */
|
||||
const TemplateCompiler = await import(
|
||||
isVapor
|
||||
? '../packages/compiler-vapor/dist/compiler-vapor.cjs.prod.js'
|
||||
: '../packages/compiler-dom/dist/compiler-dom.cjs.prod.js'
|
||||
(isVapor
|
||||
? '../packages/compiler-vapor/dist/compiler-vapor.cjs'
|
||||
: '../packages/compiler-dom/dist/compiler-dom.cjs') + prodSuffix
|
||||
)
|
||||
const runtimePath = path.resolve(
|
||||
import.meta.dirname,
|
||||
isVapor
|
||||
? '../packages/vue-vapor/dist/vue-vapor.esm-browser.prod.js'
|
||||
: '../packages/vue/dist/vue.runtime.esm-browser.prod.js',
|
||||
(isVapor
|
||||
? '../packages/vue-vapor/dist/vue-vapor.esm-browser'
|
||||
: '../packages/vue/dist/vue.runtime.esm-browser') + prodSuffix,
|
||||
)
|
||||
|
||||
const mode = isVapor ? 'vapor' : 'vdom'
|
||||
|
@ -149,7 +157,7 @@ async function buildApp(isVapor) {
|
|||
'import.meta.env.IS_VAPOR': String(isVapor),
|
||||
},
|
||||
build: {
|
||||
minify: 'terser',
|
||||
minify: !devBuild && 'terser',
|
||||
outDir: path.resolve('./client/dist', mode),
|
||||
rollupOptions: {
|
||||
onwarn(log, handler) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "pnpm start --noHeadless --skipBench --vdom",
|
||||
"dev": "pnpm start --devBuild --noHeadless --skipBench --vdom",
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in New Issue