-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
base option not support fully url at dev mode #8527
Comments
https://github.com/vitejs/vite/blob/main/packages/vite/src/node/config.ts#L600 in document, the |
The full URL is supported in prod only (which can probably be better documented). Absolute urls in dev doesn't make sense as you're already serving the files via the url the vite dev server is on, e.g. localhost:3000. I'm assuming you want to serve "assets" only via a different host, maybe #8450 fits your needs? |
actually, there are two servers is running,
that look like Single-SPA, if developer visit 3000, all be fine. but some assets will be 404 when they visit 10000. if the url not change, any other config just helpless. |
One of the reasons that #8450 adds the options at |
@patak-dev no help for me. #8430 or #7644 add relative base, but what i need is full url absolute base... |
@patak-dev dose enable full url public path while developing make any hidden trouble? |
@Yiniau How is this set up? Are you using iframes? Is there a server in front of Vite? |
basicly, that's a new way to provide micro-frontends with a light runtime dep, you can checkout https://native-spa-route.vercel.app/custom-render/react/17/with-css to get simple demo. the 10000 is a complete service, 3000 is a complete service too. They are related by agreement, 3000 output page content, 10000 output application framework content. The pseudo-code: // 10000 main.html
// all in html
<app>
<header/>
<side-menu/>
<page-1 render-js-function-source="http://localhost:3001/src/main.ts" />
<page-2 render-js-function-source="http://localhost:3002/src/main.ts" />
<page-3 render-js-function-source="http://localhost:3003/src/main.ts" />
</app> So, if there is no public path for development, some static resources will 404 |
I see. For a workaround, doing the following might work:
|
Actually, only 'some' resource like image will 404, this sounds to work for me, THANKS |
Describe the bug
from #833, the last comment.
In my case, use base like this:
But when i visit the http://localhost:3003/, the assets is not be rewrited
if this page is nested in a "main" page, this request will be 404
Reproduction
https://stackblitz.com/edit/vitejs-vite-ofxh2y?file=vite.config.js&terminal=dev
System Info
System: OS: macOS 12.3.1 CPU: (8) arm64 Apple M1 Memory: 97.41 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 18.0.0 - /opt/homebrew/bin/node npm: 8.6.0 - /opt/homebrew/bin/npm Browsers: Chrome: 102.0.5005.115 Safari: 15.4 npmPackages: vite: ^2.9.9 => 2.9.9
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: