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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add %PUBLIC_URL% support #474

Merged
merged 2 commits into from Jun 11, 2020
Merged

Add %PUBLIC_URL% support #474

merged 2 commits into from Jun 11, 2020

Conversation

drwpow
Copy link
Collaborator

@drwpow drwpow commented Jun 11, 2020

From #464, adds the ability to set buildOptions.baseUrl in the Snowpack config. This replaces %PUBLIC_URL% with that at build time, and / at dev time.

Given baseOptions: { baseUrl: '/static/' }

Dev
Note: all URLs start with /

Screen Shot 2020-06-10 at 6 14 32 PM

Build
_Note: all URLs start with /static/ from our config! 🎉 _

Screen Shot 2020-06-10 at 6 15 07 PM

Source HTML
Note: all URLs start with %PUBLIC_URL%

Screen Shot 2020-06-10 at 6 15 48 PM

@drwpow drwpow requested a review from FredKSchott June 11, 2020 00:15
@drwpow drwpow requested a review from a team as a code owner June 11, 2020 00:15
@drwpow drwpow force-pushed the drwpow/public-url branch 5 times, most recently from 3f97ba8 to e6ea464 Compare June 11, 2020 00:29
Copy link
Owner

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@drwpow drwpow merged commit f268af6 into master Jun 11, 2020
@drwpow drwpow deleted the drwpow/public-url branch June 11, 2020 14:45
@danprince
Copy link
Contributor

@drwpow What's the plan for getting the baseUrl into the rewritten imports statements (as in #476)? Want me to update that branch with the new baseUrl?

@drwpow
Copy link
Collaborator Author

drwpow commented Jun 11, 2020

Yes I believe that makes sense! If my thinking is correct, I think the path for web modules should be something like:

[baseUrl] / [webModulesDir] / some-dep.js

Keeping in mind that both baseUrl and the webModulesDir (whatever that ends up being called) can both be multiple folders, not just one. I think this would work for most setups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants