-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
error: exports is not defined
when using ViteDevServer.ssrLoadModule
#2890
Labels
Comments
I solved it temporarly by using This is an example: import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const cookie = require('cookie'); |
Duplicate of #2579? |
yep 👍🏽 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
error:
exports is not defined
when usingViteDevServer.ssrLoadModule
with the following setups:package.json
index.js
so basically, this won't work even if it really should.
Dirty Workaround?
Change the the "exports" field in
package.json
to*.mjs
and returnrequire.resolve(bootSSR)
instead of the package name itself works:package.json
index.js
Is this the intended way to resolve package name(Subpath exports) in the SSR mode..?!
System Info
vite: 2.1.5
node: v14.11.0
Used package manager: yarn
The text was updated successfully, but these errors were encountered: