-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Reference Error in Vue3 When Using ESM Runtime Bundle (for in HTML templates) #8015
Comments
Experiencing the same behavior. @an0nusr thank you so, so much for the workaround! Parcel 2.2.1 |
Ok, so this is a bit confusing, but for any vue bundle with the runtime tag ("vue.runtime.*"), you can't use runtime compilation, as those bundles "only contain the runtime". See this Basically, you have to alias "vue" as "vue/dist/vue.esm-bundler.js" if you want runtime compilation of templates. |
Hmm, production still errors out with the same error, and I just noticed that your error log has the |
I'm guessing it's related to |
tried today parcel I like it better then vite, but I have this issue too |
This seems to go against Vue's documentation which states that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
What is the resolution here? When I build my vue application for prod this appears to happen on any component that relies on runtime compilation.
|
I am also seeing this on Parcel v2.12.0. In my case I have some vue SFC and some components that need the runtime compiler on the same page. Getting the same errors as @an0nusr and the --no-scope-hoist flag did indeed work as a work-around. Anyone get anywhere with this past the workaround? |
🐛 bug report
When running in development, there are no issues, but after running
parcel build
, the application fails to run with ReferenceErrors.This seems similar to bug #6711, but only occurs for me when working with runtime templates (when using the
vue.runtime.esm-bundler.js
file). When working with Vue files/compiled templates, I don't see the problem.I'm able to work around the issue by adding
--no-scope-hoist
to the build command.🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Built version should behave like the dev version (no reference errors)
😯 Current Behavior
Page fails to load with the following error:
🔦 Context
I would like to use vue with in-html templates because I'm building a web app that itself is a template. I'd like it to be easy for people to modify how things look without having to rebuild the javascript components.
With the
--no-script-hoist
work around, this isn't a major issue, but it isn't well documented/called out.💻 Code Sample
Full code is available here (though this uses the
no-scope-hoist
workaround): https://github.com/an0nusr/storything/tree/vue-with-html-templateAn alternate version using Vue SFCs instead is here (and doesn't have the issue): https://github.com/an0nusr/storything/tree/vue
🌍 Your Environment
The text was updated successfully, but these errors were encountered: