You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create new project with Vue CLI - select Vue 3 preset
Modify build command in package.json by adding --report
create vue.config.js and enable runtime compilation - runtimeCompiler: true (which switches vue alias to vue.esm-bundler.js)
run yarn build
Check dist\report.html
What is expected?
"vendors" bundle should not include @babel/parser package (230 KB)
What is actually happening?
@babel/parser is part of the production bundle...
As anything from @babel/parser is not included in browser compiler builds of Vue (vue.esm-browser.js for example), it should not be included when used with bundler build
...the code which is intended to run in the browser is used ONLY in DEV build and eliminated in production build which leaves the rest of the processExpression function (which is using @babel/parser) in the bundle
The text was updated successfully, but these errors were encountered:
Watching this one keenly, for a project I am conducting we have no choice but to compile some templates on the fly. I'm aware there was an entire re-write between Vue 2 and Vue 3 but using the equivalent version of Vue does not drag in the entire babel parser library so I'm hopeful a resolution can be found for Vue 3.... otherwise performance wise I'm in trouble if not before we need to go to production.
Version
3.0.2
Reproduction link
https://github.com/Liwoj/vue3-with-compiler
Steps to reproduce
build
command inpackage.json
by adding--report
vue.config.js
and enable runtime compilation -runtimeCompiler: true
(which switches vue alias tovue.esm-bundler.js
)yarn build
dist\report.html
What is expected?
"vendors" bundle should not include
@babel/parser
package (230 KB)What is actually happening?
@babel/parser
is part of the production bundle...As anything from @babel/parser is not included in browser compiler builds of Vue (
vue.esm-browser.js
for example), it should not be included when used with bundler buildI'm not an expert on Vue 3 codebase but it seems problem is in the https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/transforms/transformExpression.ts#L90
processExpression
functionSame code in
@vue/compiler-core/dist/compiler-core.esm-bundler.js
(NPM package)...the code which is intended to run in the browser is used ONLY in DEV build and eliminated in production build which leaves the rest of the
processExpression
function (which is using @babel/parser) in the bundleThe text was updated successfully, but these errors were encountered: