-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Ability to remove leading "/" from built index.html src/href tags #437
Comments
From the look of it, this is not simply a path change. You also have to change how the router work and other stuffs since preact-cli assumes that it will be deployed at top-level path |
hmm - we need to have explicit (domain-relative) paths for assets because of client-side routing. If a user visits the "about" page of your app ( We support setting the "base path" / "mount path" for your application via the preact build --homepage /folder1/path/app/
# or
HOMEPAGE=/folder1/path/app/ npm run build Perhaps this is what you were looking for? |
Can I set the homepage to “”? I’ll play with this. Thanks! |
|
@mellogarrett it's proposed syntax for changing that. It wasn't implemented (yet) |
My bad, I thought we had merged the HOMEPAGE bit - you have to use export default function (config, env, helpers) {
config.output.publicPath = '/test/path/'
} To get the result I mentioned above: export default function (config, env, helpers) {
config.output.publicPath = process.env.HOMEPAGE
} (from #323 (comment)) |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Running
npm run build
results in hardcodedsrc
andhref
values with a leading '/'If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
I'd like to be able to remove the '/' so that I can access my assets from the same directory the app is served from, not the origin directory.
Example:
App served from
https://www.domain.com/folder1/path/app/index.html
App tries to pull assets from
https://www.domain.com/
I want them to be pulled from
https://www.domain.com/folder1/path/app/
It can be achieved by simply removing the leading '/' from the src or href in the html, but I'd like to make this part of my build process.
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information.
The text was updated successfully, but these errors were encountered: