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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra forward slash when publicOutputDir setting is blank #161

Closed
vtt opened this issue Dec 20, 2021 · 3 comments
Closed

Extra forward slash when publicOutputDir setting is blank #161

vtt opened this issue Dec 20, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@vtt
Copy link

vtt commented Dec 20, 2021

Description 馃摉

When publicOutputDir setting is blank, the resulting URLs have extra forward slash (//) and browser interpretes that as absolute path which is invalid.

Reproduction 馃悶

Use the following config/vite.json

{
  "all": {
    "assetsDir": "assets",
    "publicDir": "public",
    "publicOutputDir": "",
    "sourceCodeDir": "app/frontend",
    "watchAdditionalPaths": []
  },
  "development": {
    "autoBuild": true,
    "port": 3036
  },
  "test": {
    "autoBuild": true,
    "port": 3037
  }
}

I did not test setting blank values for assetsDir and publicDir; but I think that they would have the same problem

@vtt vtt added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Dec 20, 2021
@vtt vtt changed the title Extra backslash when publicOutputDir setting is blank Extra forward slash when publicOutputDir setting is blank Dec 20, 2021
@ElMassimo ElMassimo added bug Something isn't working and removed bug: pending triage Something doesn't seem to be working, but hasn't been verified labels Dec 20, 2021
@ElMassimo
Copy link
Owner

ElMassimo commented Dec 20, 2021

For a while, the dev server proxy relied on publicOutputDir as a "prefix" to detect requests for the Vite dev server.

Now that Vite has patched bugs related to HMR requests, the proxy can rely on file existence.

I'll consider supporting "publicOutputDir": "", allowing you to have Vite as the only source for frontend assets if that's what you want.

@vtt
Copy link
Author

vtt commented Dec 20, 2021

I think the issue here is with publicOutputDir; the documentation does not mention that the value cannot be blank. However, setting a blank value would generate invalid URLs.

@ElMassimo
Copy link
Owner

Sorry, typo, publicDir => publicOutputDir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants