node-influx/node-influx

Publish native ES module

dandv opened this issue · 6 comments

dandv commented

Node v8.5.0 has just added experimental support for modules behind a flag, and now compliant modules can be imported directly, without any transpiler, if they have the .mjs extension.

By omitting the extension in the main field of package.json, the module will be compatible with Node pre 8.5.0.

dandv commented

Update: created repo showing Node being unable to import the FieldType symbol with --experimental-modules.

This commit in my repo localISOdt shows how to add .mjs support:

  • rename index.js to index.mjs
  • change the main field in package.json to index (no extension)
  • adjust the prepare babel script to output the .js
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dandv commented

Maybe this should be tabled until October, when the --experimental-modules flag is expected to drop?

Sounds like a good plan to me. I don't see much point in developing on experimental node flags for node-influx for the time being. Happily accept a PR later along the line though. Closing for now.

dandv commented

Any chance to have TypeScript with target and module also set to esnext, now that a few months have passed since Node removed the experimental flag for ES modules?

Great, yes! Please submit a PR :shipit: