-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
CommonJS Import with vite@0.15.3 #162
Comments
To clarify: the expectation would be that vite would convert this commonjs package to an esm module and thus the import should work? Is this package in |
Yes, thats whate I expect :) !
If i move it to
|
Oops, after a while, an error comes up =>
|
I recently came across this issue as well.
No need to add any more code or import, it won't launch and eventually throws the stack trace error similar to the one above. In fact, I get another wall of heap errors if I wait a few more minutes. I only planned on requiring this in electron's main process, so contrary to @Cjumelin, I'd expect it to be ignored; or at least, a way to configure it to be ignored. Moving it to a devDependency does resolve this. node 13.13.0 |
Currently we need to explicitly list named exports for CommonJS modules to support named imports (if no named exports are provided, you can only import it as a default import and get an object which is what you'd get from a We can auto detect named exports to a certain extent, which I will try to fix Monday; also from what I saw the next minor release of |
It is similar to #174 |
Sorry, this happened... |
Closing as wontfix since Vite will not go out of its way to support arbitrary CommonJS deps, and I think for a new tool like Vite, we should take the opportunity to push users to prefer ESM compatible libraries and move the ecosystem forward. |
I had same problem with
So instead of importing Also you have to add the package in vite.config.js file like this -> |
Describe the bug
Actualy trying to import a dependencie :
Who's exported like this in the node_modules :
And got this error from the browser (GoogleChrome) :
Uncaught SyntaxError: The requested module '/@modules/remote-redux-devtools' does not provide an export named 'composeWithDevTools'
Reproduction
Working on.
System Info
macOS Catalina (V 10.15.1)
node -v > v12.16.3
also tryv14.2.0
yarn -v > v1.22.4
The text was updated successfully, but these errors were encountered: