How do I add a resolve.alias fallback in case the CDN is down? #19158
Replies: 1 comment
-
|
What you have now is really just telling Vite/Rollup to rewrite the import source during bundling/dev resolution. It does not give you a real “try CDN A, then CDN B” runtime fallback.
If you keep React external, I would not try to solve HA through Vite aliasing. I’d solve it at the deployment/runtime layer. So the short answer is: no, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I am bundling my app using Vite. I am using React and ReactDOM and I noticed that they made my bundle huge so I am importing them externally from a CDN instead of including it in the bundle. This a relevant snippet of my vite.config.js:
I know that if the CDN I'm using (esm.sh) is down, my whole app will be down as well because it is dependent on react and react dom. Is there anything I can do to add an alternative CDN in case this happens? Or are there any other solutions?
Beta Was this translation helpful? Give feedback.
All reactions