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

ReferenceError: require is not defined #986

Closed
905868332 opened this issue Oct 30, 2020 · 4 comments
Closed

ReferenceError: require is not defined #986

905868332 opened this issue Oct 30, 2020 · 4 comments

Comments

@905868332
Copy link

How to solve

@antfu
Copy link
Member

antfu commented Oct 30, 2020

Vite is built on top of ESM which does not support require, use import instead

@antfu antfu closed this as completed Oct 30, 2020
@905868332
Copy link
Author

Vite is built on top of ESM which does not support require, use import instead

But some packages use require internally. What to do at this time ?

@antfu
Copy link
Member

antfu commented Oct 30, 2020

See #826 (comment) and #826 (comment)

@aleclarson
Copy link
Member

Packages that use require internally are not supported, because that's a NodeJS feature that can't be shimmed with import syntax. Especially without bundling.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants