Open wclr opened 9 months ago
Start a new pull request in StackBlitz Codeflow.
Your reproduction doesn't include the plugin and the code.
Hello @wclr. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
Hello @wclr. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with
need reproduction
will be closed if they have no activity within 3 days.
I have updated it.
I am kind of curious. Should it be /my/file.js?wow&type=classic&worker_file
?
And it looks like the search params are being intentionally deleted to make it safe. If we were to bring the the params back, how should we bring it back safely? Or do params cause no security harm at all?
Another thing that is related to file params, is that during the build plugins (neither rollupOptions.plugins
no worker.plugins
) do not get any access to to params (in resolveId
or transform
).
Also during the build for new Worker(new URL(
ids do not have worker_file
params (added by vite in dev mode) . So, it is not possible to identify if the module is loaded as worker entry. This is just an example of inconsistency that dev and build have.
One more reference as it hasn't been mentioned yet. It doesn't change the fact that new URL(...)
is inconsistent, but the worker url import ?worker&url
seems to naturally work with resolveId/transform hooks.
https://stackblitz.com/edit/vitejs-vite-xrrkvk?file=main.js
import workerUrl2 from './test2.js?wow2&worker&url';
const worker2 = new Worker(workerUrl2, { type: 'module' });
// -- log --
// commmon resolve id ./test2.js?wow2&worker&url
// commmon transform id /home/projects/vitejs-vite-xrrkvk/test2.js?wow2&worker&url
// commmon resolve id /test2.js?type=module&worker_file
// commmon resolve id /test2.js?type=module&worker_file
// commmon transform id /home/projects/vitejs-vite-xrrkvk/test2.js?type=module&worker_file
Describe the bug
doesn't provide "?wow" param in
resolveId
ortransform
handlers. In transform/my/file.js?type=classic&worker_file
but no custom "wow" param.Reproduction
https://stackblitz.com/edit/vitejs-vite-kjwrqy?file=vite.config.js,main.js,index.html&terminal=dev
In the terminal you may see (no
?wow
param)Steps to reproduce
Create plugin with
resolveId
andtrasnform
and see id.System Info
Used Package Manager
pnpm
Logs
No response
Validations