Import Protection: Shift Left #7390
Unanswered
jamesarosen
asked this question in
Q&A
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently upgraded to
@tanstack/solid-start@1.167.56and started getting import protection warnings. This is a great feature. Thank you, @schiller-manuel!This example code runs in the standard middleware stack, so any page-load should trigger it. The fix is straightfoward: move the
importinside the.server()block at the bottom of the file.I've noticed that the warnings only emit when Tanstack (Vite) encounters the import. If it's a dynamic import, it may be quite a while before someone happens to invoke that code-path and notices the warning.
Despite the warning, my production builds are working fine. The
{ dev: 'mock', build: 'error' }default doesn't seem to be doing anything. Nor does overriding it with{ behavior: 'error' }.I'd love to shift these issues left. Ideally, some sort of deterministic check that I can put in my lint / test cycle as a guardrail for agents.
Beta Was this translation helpful? Give feedback.
All reactions