Correctly build dependency URLs (for CSS)#2740
Conversation
Fix real core issue of #2518
Parcel parcel-bundler/parcel#2740 parcel-bundler/parcel#2736 also removed --experimental-scope-hoisting until upgrade works
|
In some places absolute urls are used (with the publicURL) and in others a relative url. Should the absolute url be used everywhere? (That's why the tests are failing) @font-face {
font-family: "Test";
src: url("/test.80d5c592.woff2") format("woff2");
/* vs */
src: url("test.80d5c592.woff2") format("woff2");
} |
|
@mischnic I think they should both be possible, not sure what the behaviour should be though. |
|
Why do we need to switch to absolute paths for CSS? One of the nice things about using relative paths is that you can move the base directory around where you deploy and it still works. |
With the current master, there are some cases where the paths somehow don't work: e.g. #2758 and #2736 Apart from that, sometimes Parcel uses a relative (this case) and sometimes a absolute path (with publicURL, e.g. in html url dependencies) |
|
I think we can probably still use the relative path for CSS, but it needs to be set here instead of in parcel/packages/core/parcel-bundler/src/Asset.js Lines 123 to 125 in 4e0024f |
|
Probably should also add a test for #2736 as well. |
|
When can we get a patch release on this? We need this ASAP at Dialpad. |
This is already released as 1.12.1. |
|
@mischnic @devongovett @DeMoorJasper Excellent, thanks guys. If you're ever in Vancouver, beers on me 🍻 |
↪️ Pull Request
Fixes #2736
Fix underlying issue and undo workaround of #2518
💻 Examples
Dependency URLs for bundles generated in subfolders would contain something like this
<img src="/../logo_color.78fe8740.svg">(not properly resolved).✔️ PR Todo