Skip to content
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

vue.runtime.global.min.js is not in a format that works with webpack using externals #5380

Closed
macu opened this issue Feb 8, 2022 · 1 comment

Comments

@macu
Copy link

macu commented Feb 8, 2022

Version

3.2.30

Reproduction link

stackoverflow.com

Steps to reproduce

Webpack, listing vue as an external library (loaded separately in the browser), produces a bundle that checks the module for __esModule (which is true on the Vue global build, as well as VueRouter, but not Vuex), but when this value is true it then expects default to be defined on the module, which is undefined.

What is expected?

import Vue from 'vue'; should work. Vue.default in the browser should return Vue, or Vue.__esModule should not be defined.

What is actually happening?

Vue.__esModule is true but Vue.default is undefined, so import Vue from 'vue'; returns undefined in my client code.


I am trying to load as much as possible from CDN; so I don't want to import Vue directly into my bundle. The current build forces me to write const Vue = window.Vue;.

@LinusBorg
Copy link
Member

import Vue from 'vue'; should work.

No. Vue 3 has no default export. You have to do named imports when using ES module syntax. that's regardless of the build version you are using - that's kind of the point.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants