-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
require is not defined error when using cjs dependency in page server files #20
Comments
I can confirm updating vite to 2.1.3 while leaving vite-plugin-ssr at 0.1.0-beta.19 also yields this error |
See vitejs/vite#2579. Is using ES modules instead an option for you? |
The exports is not defined error seems different. I was getting that one too and was able to work around by placing a |
I mean, for this dependency, maybe, since it's one I control. But there are all kind of CJS packages on the npm registry that seem to be rendered unusable by this. If you're fairly confident it's not due to a problem with your plugin I can chase down a minimal repro to flag in the vite repo |
Not necessarily: Vite treats user-land code differently than
Yes I am; syntatic stuff is handled by Vite and
That would be great. You can start off https://github.com/vitejs/vite/tree/main/packages/playground/ssr-vue.
In case you want to dig deeper: vitejs/vite@v2.1.2...v2.1.3. |
As far as I can tell, this is resolved in [email protected] |
Reproduction Steps
Expected Results:
Commonjs dependencies should be transpiled to ES per Vite documentation and supported without throwing errors.
Notes:
The text was updated successfully, but these errors were encountered: