Publish native ES module
dandv opened this issue · 6 comments
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.
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 inpackage.json
toindex
(no extension) - adjust the
prepare
babel script to output the .js
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.
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.
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