Issues with mount/baseUrl with a non root path #2279
Unanswered
atombrenner
asked this question in
Troubleshooting
Replies: 1 comment 6 replies
-
Snowpack v3.0 got more explicit with how we treat URLs in your source code:
Not sure if that directly answers your question, but is just to say that relative imports are 100% supported and even encouraged in almost all cases when importing files. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use snowpack for many small PoC projects that should run on the same domain but with different paths.
Ideally, my app should contain only relative paths so that I can develop locally with
/
as root, then runsnowpack build
and copy them to the app1 folder. To have a compact deploy package I use the following bundling configuration:Unfortunately, I can't figure out how to use relative paths. The best I could achieve was to put relative paths in index.html and configure the mount and build options:
Through magic, all css files are then bundled and correctly referenced in index.html with this generated line
But all images are missing in the built app, because the path to images is still absolute, something like this is generated:
Using relative paths in mount option gives me an error. My next try was to configure the desired path everywhere and fix the links in index.html:
Now the built app runs as expected. But unfortunately, now I can't use
snowpack start
anymore as this expects that everything runs at root level/
. I have found this line inutils.ts
, which indicates to me, that local development should only be done at the root level:Do you have any suggestions? I can see two options:
Beta Was this translation helpful? Give feedback.
All reactions