fix(core): preserve query in bundleless redirects - #1707
Conversation
Current issue and scope of this PRThe core issue is that bundleless redirect only rewrites import specifiers, while artifact generation is handled separately. Simply preserving a query does not mean that the semantics of This draft PR is currently scoped as follows:
The CSS Modules handling covers different preprocessors rather than only Regular assets cannot use the same path-preservation logic directly because bundleless asset handling currently looks roughly like this: For example, redirect could preserve this import: import raw from './logo.png?raw';However, if the build only emits a JS wrapper or Therefore, this PR only fixes cases where JS, CSS, and CSS Modules already have a well-defined output artifact and redirect was dropping the query. Asset and SVGR support should be designed separately together with asset externalization/copying and proxy-module generation. Bundle mode continues to rely on bundler/loader query handling; this change is focused on bundleless redirect behavior and is not intended to change bundle-mode semantics. |
Summary
This PR fixes bundleless redirect handling for JS and style imports with query strings. JS/TS redirects now preserve query and fragment parts while rewriting extensions, plain CSS keeps query strings when redirecting to emitted CSS files, and CSS Modules with query strings redirect to the emitted CSS asset instead of putting the query on the JS wrapper. Asset and SVGR query semantics are intentionally left out of this PR for a separate bundleless asset output design.
Checklist