-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use with vite-env-only #298
Comments
Why not just use: "use server" in the first line of |
I may have tried that, but I've lost context as I switched off of solid-start for now due to these issues of server code leaking into the client. Overall, I want to enforce at build time that there hasn't been any server code leaked, whether or not |
I was attempting to use the
vite-env-only
plugin with a solid-start template, but found that the use ofuse server
causes thedenyFiles
configurations to fail to work for transitive dependencies. An example would beclient.js
->api.js
->db.js
, where api.js hasuse server
directives, anddb.js
is listed in thedenyFiles
client array in the vite config.I'm not familiar with the internals, but since I noticed that the resulting api asset (.vinxi/build/client/_build/assets/api-....js) has the definition of
db.js
inlined, my guess is that theuse server
directive is processed first and generates a new module that no longer referencesdb.js
, so the vite-env-only plugin is no longer able to detect it the import.It would be nice to use the vite-env-only plugin to enforce the invariant that secrets or server code do not split into the client bundle, but perhaps that functionality could be provided directly by vinxi.
The text was updated successfully, but these errors were encountered: