We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
serverPluginModuleResolve currently prefers .js files over .mjs files when using direct deep imports.
serverPluginModuleResolve
.js
.mjs
A quick&dirty fix would be to replace the .js with an .mjs extension and serve that file if it exists. Not sure what a proper solution would be.
Add the following import to a basic vite setup:
import { Kinds } from 'graphql/language/kinds';
(See https://github.com/sventschui/vite-mjs-repro)
vite
Browser console:
Uncaught SyntaxError: The requested module '/@modules/graphql/language/kinds' does not provide an export named 'Kinds'
The text was updated successfully, but these errors were encountered:
Dug a bit into this and the origin is in resolve-from. Internally it calls a private node resolution method:
resolve-from
Module._resolveFilename(moduleId, { id: fromFile, filename: fromFile, paths: Module._nodeModulePaths(fromDirectory) });
Trouble is that node has no knowledge of the module field in package.json. It's something exclusively used by bundlers.
module
package.json
Sorry, something went wrong.
02753b7
Successfully merging a pull request may close this issue.
Describe the bug
serverPluginModuleResolve
currently prefers.js
files over.mjs
files when using direct deep imports.A quick&dirty fix would be to replace the
.js
with an.mjs
extension and serve that file if it exists. Not sure what a proper solution would be.Reproduction
Add the following import to a basic vite setup:
(See https://github.com/sventschui/vite-mjs-repro)
System Info
vite
version: `=> 0.14.2Logs (Optional if provided reproduction)
Browser console:
The text was updated successfully, but these errors were encountered: