feat: implement true ESM#479
Open
wojtekmaj wants to merge 1 commit into
Open
Conversation
Efforts were made to introduce ESM builds in node-cron. Unfortunately, they were not fully completed: /dist/esm still contains code compiled to CJS and [arethetypeswrong](https://arethetypeswrong.github.io/) reports CJS default export on ESM environments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Efforts were made to introduce ESM builds in node-cron. However, they were not fully completed.
What was done
*.tgzto .gitignore to ignore the file thatnpm packoutputsprepublishOnlytoprepackto build the package before packing it - not necessarily with the intention of immediately publishing it/some-module.js->./some-module.js,./some-directory->./some-directory/index.js)type,types,exportsfields inpackage.jsonpackage.jsonin/dist/cjsguiding Node.js module resolution algorithmverbatimModuleSyntaxsetting was enabled to prevent TypeScript from creating empty modules, likedist/esm/tasks/scheduled-task.js:What still needs attention
startDaemonBefore
/dist/esmstill contains code compiled to CJS:https://www.npmjs.com/package/node-cron?activeTab=code
and arethetypeswrong reports CJS default export on ESM environments:
https://arethetypeswrong.github.io/?p=node-cron%404.2.1
After
/dist/esmcontains ESM code:and arethetypeswrong CLI reports no issues with module resolution: