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 importing CommonJS module that works with --experimental-modules #9938
Comments
Hey @dandv! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
That module doesn't have a default export; only named imports: https://github.com/node-influx/node-influx/blob/master/src/index.ts. With node you can only import it as default because node doesn't know about Babel/TypeScript/Webpack way of handling transpiled es modules. |
I found the same problem with other modules, e.g. faast.js and graphql-tools. Is there a TypeScript transpilation setting that these modules could enable? |
They could this code to their entry point import * as mod from "./this-file.js";
export default mod; By doing so, everythins is exported both as a named export and as a property of the default export. Another option is that they also ship untranspiled ES modules (which should not |
Bug Report
Current Behavior
I'm trying to use the default import with node-influx. This works with
node --experimental-modules
, but not with Babel and thetransform-modules-commonjs
plugin.Input Code
import-influx.mjs
Expected behavior/code
Babel Configuration (babel.config.js)
Environment
cli
(babel-node)The text was updated successfully, but these errors were encountered: