Skip to content
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

Form action triggers drizzle polyfill issues. #203

Open
anxhirr opened this issue Apr 29, 2024 · 2 comments
Open

Form action triggers drizzle polyfill issues. #203

anxhirr opened this issue Apr 29, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@anxhirr
Copy link

anxhirr commented Apr 29, 2024

For the last 24 hours I have been unable to build my project. It was giving me this error

5: import { performance } from 'perf_hooks'
            ^
6:
7: import { stringify, handleValue, arrayParser, arraySerializer } from './types.js'
error during build:
RollupError: "performance" is not exported by "__vite-browser-external", imported by "node_modules/postgres/src/connection.js".

So, apperently drizzle uses perf_hooks(and many other node libs) internally which vite is unable to polyfill outside of server.
I managed to polyfill them, but each time a new error was appearing and a new lib required polyfill etc which made me realize polyfilling is not the way to go.
Afaik drizzle is supposed to only run on the server and therefore inside
formAction it is supposed to be on the server. After some testing I made I found out that removing drizzle from formAction solved the issue and build was successful. It works perfectly on routeAction$, globalAction$ and routeLoader$. Iirc, formAction builds on top on globalAction and therefore this was supposed to not be a problem.
I must be missing something.

I will attach a sanbox or repo link below

@fabian-hiller
Copy link
Owner

This is a known problem, see QwikDev/qwik#5160. I will try to fix it in the next 3 months. A workaround could be to wrap you code into if (isServer) inside of formAction$.

@fabian-hiller fabian-hiller self-assigned this Apr 29, 2024
@fabian-hiller fabian-hiller added the bug Something isn't working label Apr 29, 2024
@anxhirr
Copy link
Author

anxhirr commented Apr 29, 2024

oh okay, thanks for the quick reply. Will take a look later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants