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

I want to use cdn to introduce vue3 and vue-router4 to reduce the size of the package, but I keep reporting errors, but it's okay to use vue2 and vue-router3. #3587

Closed
xiguazhiPrince opened this issue Jul 5, 2021 · 1 comment

Comments

@xiguazhiPrince
Copy link

Version

3.5.2

Reproduction link

[https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPCFET0NUWVBFIGh0bWw XG48aHRtbD5cbiAgPGhlYWQ XG4gICAgPG1ldGEgY2hhcnNldD1cInV0Zi04XCI XG4gICAgPG1ldGEgbmFtZT1cInZpZXdwb3J0XCIgY29udGVudD1cIndpZHRoPWRldmljZS13aWR0aCxpbml0aWFsLXNjYWxlPTEuMFwiPlxuICAgIDx0aXRsZT7opb/mioDmnK88L3RpdGxlPlxuICAgIDwhLS0gYnVpbHQgZmlsZXMgd2lsbCBiZSBhdXRvIGluamVjdGVkIFRPRE8gQ0RO5LyY5YyWIC0tPlxuICAgIDxsaW5rIHJlbD1cInN0eWxlc2hlZXRcIiB0eXBlPVwidGV4dC9jc3NcIiBocmVmPVwiaHR0cDovL3VucGtnLmNvbS92aWV3LWRlc2lnbi9kaXN0L3N0eWxlcy9pdmlldy5jc3NcIj5cblxuICAgIDxzY3JpcHQgc3JjPVwiaHR0cHM6Ly91bnBrZy5jb20vdnVlQDMuMC41L2Rpc3QvdnVlLmdsb2JhbC5qc1wiPjwvc2NyaXB0PlxuICAgIDxzY3JpcHQgc3JjPVwiaHR0cHM6Ly91bnBrZy5jb20vdnVlLXJvdXRlckA0LjAuMy9kaXN0L3Z1ZS1yb3V0ZXIuZ2xvYmFsLmpzXCI PC9zY3JpcHQ XG5cbiAgICA8c2NyaXB0IHR5cGU9XCJ0ZXh0L2phdmFzY3JpcHRcIiBzcmM9XCJodHRwOi8vdW5wa2cuY29tL3ZpZXctZGV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G4gIDwvYm9keT5cbjwvaHRtbD5cbiJ9)

Steps to reproduce

Use @ vue/cli 4.5.6.

With vue3, introduce the following in the < head > of index.html: < script src= "...vue @ 3.0.5/dist/vue.global.js" > < / script >. < script src= "... vue-router@4.0.3/dist/vue-router.global.js" > < / script >.

Then configure in webpack.base.conf.js. Externals: {. 'vue': 'Vue' 'vue-router': 'VueRouter' }.

What is expected?

reduce the size of the package

What is actually happening?

I want to use cdn to introduce vue3 and vue-router4 to reduce the size of the package, but I keep reporting errors, but it's okay to use vue2 and vue-router3.

Use @ vue/cli 4.5.6.

With vue3, introduce the following in the < head > of index.html:

< script src= ".vue @ 3.0.5/dist/vue.global.js" > < / script >.
< script src= "... vue-router@4.0.3/dist/vue-router.global.js" > < / script >.

Then configure in webpack.base.conf.js.
Externals: {.
'vue': 'Vue'
'vue-router': 'VueRouter'
}.

Then report an error:
Ncaught TypeError: Cannot read property 'version' of undefined.
(version = Vue.version.split ('.') .map (Number)).
And.
Dom.js:2 Uncaught TypeError: Cannot read property 'prototype' of undefined.
At Object. < anonymous > (dom.js:2)

@posva
Copy link
Member

posva commented Jul 5, 2021

See vuejs/router#694

Use the forum and chat to ask questions

@posva posva closed this as completed Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants