Closed DaveAllbirds closed 1 year ago
Thanks for reporting the problem. The two errors that you reported are coming from the same file and are caused by the same underlying issue.
The Hydrogen-v1 react-server-dom-vite-plugin
is not sanitizing import parameters before attempting to use them (see here). The runtime error is similar in that it's not considering that imports may have a query string parameter (see here).
It is perfectly valid for imports to have a query string appended and Wallaby does this as a part of its cache-breaking mechanism. Vite uses Rollup as it's bundler. The rollup docs actually provide an example of appending a query string suffix, which Wallaby and many other plugins do. Depending on your vite configuration, you would be able to break Hydrogen-v1 in the same way without Wallaby. In Hydrogen's case, the plugin is marked as experimental, (see here) so it may not be fully functional. In contrast, you can see how vitest
santizes the request (id
parameter) here.
We should be able to get Wallaby working for you by patching Hydrogen-v1's vite plugins so that they correctly process import parameters. Unfortunately we were not able to find a sample or docs for how to set up Hydrogen v1 with vitest
(many of the links appear to be broken now, I'm assuming because Hydrogen-v1
is now the legacy version). We need a sample to understand how the files are processed at runtime so that we can create a patch for Hydrogen-v1 and so that we can test it.
--
If you're able to provide us with a sample repo that breaks in the same way, we should be able to fix/patch the relevant Hydrogen
libraries, which will allow you to use Wallaby.
Issue description or question
Running Shopify's Hydrogen v1 and getting errors on .server files when trying to run Wallaby.
I get the following error:
I've also been running into issues with the wallaby query string appended:
Wallaby diagnostics report