You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vite 8 regression: cross-origin classic script request to /src/*.ts returns 403 #21849
Vite 8 dev server returns 403 Forbidden for cross-origin classic script requests to /src/*.ts files, while the same setup works in Vite 7.3 and in rolldown-vite.
This was reproduced with a minimal setup using only the vanilla-ts template.
Reproduction setup:
Project A: plain Vite vanilla-ts app
Project B: plain Vite vanilla-ts app
Project A loads a source file from Project B using a classic script tag:
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
This is a somewhat unusual setup, so here is the context.
I’m using Vite with Blazor WASM via backend integration. In practice, Vite is used for SCSS and normal ESM TypeScript modules.
The exception is my custom TinyMCE plugins. TinyMCE external_plugins expects a URL to a plugin entry file that TinyMCE loads itself at startup, rather than an ESM import handled by my app/bundler.
So this is not me trying to use /src/*.ts as a public asset endpoint in a generic way, but rather a result of integrating custom TinyMCE plugins in a Blazor setup where the other integration options I tried did not work for me.
The reason I reported it is that the same setup worked on Vite 7.3.x, but returns 403 Forbidden on Vite 8, while opening the same URL directly still works.
So I understand this may not be a primary Vite use case, but from my side the Vite 7 -> 8 behavior change made it look regression-like, which is why I reported it.
If this is not a supported use case in Vite 8, I’d be happy to know that explicitly so I can look for a different integration strategy.
Thanks, crossorigin solved the original 403 on my side.
In my case, because I am using the TinyMCE Blazor wrapper, I could not pass this through the normal C# Conf object since TinyMCE expects a JavaScript callback there. The working solution was to use JsConfSrc and define:
crossorigin: ()=>'anonymous'
That fixed the cross-origin loading problem for my TinyMCE plugin entry.
After that, I ran into a separate issue where a plugin entry containing top-level import type ends up with export {}; in the served output, which then breaks because TinyMCE loads it as a classic script.
That second issue does not happen for me with regular Vite 7.3.1. I can reproduce it with Vite 8 and with rolldown-vite, so it seems to be a separate topic rather than part of this original 403 regression.
So from my side, the original 403 is resolved by using crossorigin via JsConfSrc.
Activity
fix: allow same-site classic script requests in no-cors mode
sapphi-red commentedon Mar 16, 2026
Since Vite serves ESM files referencing files with a script tag without
type="module"does not make sense to me.Denis6902 commentedon Mar 16, 2026
This is a somewhat unusual setup, so here is the context.
I’m using Vite with Blazor WASM via backend integration. In practice, Vite is used for SCSS and normal ESM TypeScript modules.
The exception is my custom TinyMCE plugins. TinyMCE
external_pluginsexpects a URL to a plugin entry file that TinyMCE loads itself at startup, rather than an ESM import handled by my app/bundler.So this is not me trying to use
/src/*.tsas a public asset endpoint in a generic way, but rather a result of integrating custom TinyMCE plugins in a Blazor setup where the other integration options I tried did not work for me.The reason I reported it is that the same setup worked on Vite 7.3.x, but returns
403 Forbiddenon Vite 8, while opening the same URL directly still works.So I understand this may not be a primary Vite use case, but from my side the Vite 7 -> 8 behavior change made it look regression-like, which is why I reported it.
If this is not a supported use case in Vite 8, I’d be happy to know that explicitly so I can look for a different integration strategy.
fix: respect server.cors config in no-cors request rejection
sapphi-red commentedon Mar 17, 2026
I guess you should be able to solve this by setting
crossoriginoption.https://www.tiny.cloud/docs/tinymce/latest/tinymce-and-cors/#crossorigin
Denis6902 commentedon Mar 17, 2026
Thanks,
crossoriginsolved the original403on my side.In my case, because I am using the TinyMCE Blazor wrapper, I could not pass this through the normal C#
Confobject since TinyMCE expects a JavaScript callback there. The working solution was to useJsConfSrcand define:That fixed the cross-origin loading problem for my TinyMCE plugin entry.
After that, I ran into a separate issue where a plugin entry containing top-level
import typeends up withexport {};in the served output, which then breaks because TinyMCE loads it as a classic script.That second issue does not happen for me with regular Vite 7.3.1. I can reproduce it with Vite 8 and with
rolldown-vite, so it seems to be a separate topic rather than part of this original403regression.So from my side, the original
403is resolved by usingcrossoriginviaJsConfSrc.