-
Notifications
You must be signed in to change notification settings - Fork 142
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
Hide base path from public URL of rollup-public-assets #1697
Conversation
This change is to enable a v2 addon to expose its public assets under the same URL as a v1 addon would. But currently, the public URL would always include the base path that you pass into the rollup plugin. Say if your v1 addon `my-addon` had `public/foo/bar.jpg`, it would expose taht under the URL of `/my-addon/foo/bar.jpg`. But if converting that to v2 and putting the file into e.g. `src/public/foo/bar.jpg`, then using the rollup plugin it would be exposed as `/my-addon/src/public/foo/bar.jpg`, and no way to get rid off the path (`src/public`). This change is removing that, which makes this a breaking one.
would if, instead, we add an option to This way, addon-authors could choose any URL scheme they want! 🎉 |
Yeah, we can do that. But instead or additionally? Like what should the plugin do by default, with the minimal usage of just passing the base path? Isn't what this PR is doing the better default? If we are concerned about the breaking change though, having this option would certainly unblock me, and we could introduce that breaking change later when we have to do that anyway for some other reason. 🤔 |
So I have actually broken this PR in the latest Main because I merged stable which added this as an option: #1867 If we want to break it again then I guess we could invert the config so it would default to having no namespace but you could specify it? Thoughts? |
I also removed the breaking label because the code has essentially been reverted now and it doesn't make sense to highlight it in the breaking changes |
Oh, missed the fact that that PR only removes the path when So my addon called Tbh, I find this pretty confusing and unexpected. At least we would need to document this behaviour, as passing in the namespace has this unexpected side effect. But I would prefer the defaults to be good, which IMHO is to leave the path out either way and get back the v1 behaviour. Even if we need to mark this as a breaking change. Or we call it a bug fix, idk... |
From team discussion: we should get |
This change is to enable a v2 addon to expose its public assets (using
addon.publicAssets()
) under the same URL as a v1 addon would. But currently, the public URL would always include the base path that you pass into the rollup plugin. Say if your v1 addonmy-addon
hadpublic/foo/bar.jpg
, it would expose taht under the URL of/my-addon/foo/bar.jpg
. But if converting that to v2 and putting the file into e.g.src/public/foo/bar.jpg
, then using the rollup plugin it would be exposed as/my-addon/src/public/foo/bar.jpg
, and no way to get rid off the path (src/public
).This change is removing that, which makes this strictly speaking a breaking one though! 🤔