Omit base tag by default?
eyelidlessness opened this issue · comments
The current default for
/, which is also the browser default. But including it can have some unexpected side effects when a
base tag is included explicitly:
#hashreferences in links will be relative to
/rather than the active page (which can be worked around by prefixing all of them with the relative/absolute path, but that can be pretty redundant and kind of a DX pain).
Some older browsers apply these same rules to
urlreferences in SVG/CSS, while most newer browsers don’t, which makes behavior unpredictable and error prone, and may increase testing surface area depending on targets.
In my opinion the
base tag is generally more trouble than it’s worth, though I definitely see it used well in the examples and can imagine large multi-build projects benefiting from it. I think a reasonable balance would be to omit it and make the core relative paths absolute by default, but accommodate it when builds want/need a nested base.
I don’t know if Snowpack/Rollup internals make other chunk paths relative by default but if they do it would probably be a heavy lift to accommodate this.
This would be a trivial change otherwise and I’d be happy to offer a PR tomorrow if it’s a welcome change.
Yeah this makes total sense, I think I was just being lazy by including it by default. PR welcome!