vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
68.67k stars 6.2k forks source link

Cdn support #1462

Closed ghost closed 3 years ago

ghost commented 3 years ago

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

Describe the bug

How to support the introduction of CDN under current vite. I found that when the CDN is introduced, if other packages are introduced inside the CDN, then the CDN will become invalid. For example, the CDN of vuex refers to import vue from'vue', then how do I change the address of this vue in vuex to cdn

System Info

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
yyx990803 commented 3 years ago

You can check out CDNs that are built for ESM:

Note that if you use these CDNs, you won't be able to bundle the deps to avoid network waterfalls unless you manually add modulepreload directives for nested dependency imports. It probably won't result in the best performance.

ghost commented 3 years ago

@yyx990803 Is there an example of using CDN for vite? I think this should be a necessity

yyx990803 commented 3 years ago

Read the docs of those CDNs?