Skip to content
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

Type definitions can fail to load when loading in a 'esmodule-mode' project #284

Closed
drfuzzyness opened this issue Mar 15, 2023 · 2 comments

Comments

@drfuzzyness
Copy link

Using this library when Typescript is configured with moduleResolution: "NodeNext", type definitions can fail to load. This is resolved by including the type definitions in the exports map of package.json.

"exports": {
"require": "./dist/cron-schedule.cjs.min.js",
"import": "./dist/cron-schedule.min.mjs"
},

The following patch fixes it:

{
...
  "exports": {
    "require": "./dist/cron-schedule.cjs.min.js",
-   "import": "./dist/cron-schedule.min.mjs"
+   "import": "./dist/cron-schedule.min.mjs",
+   "types": "./dist/index.d.ts"
  },
...
}

Love your library!
@P4sca1
Copy link
Owner

P4sca1 commented Mar 30, 2023

Hey @drfuzzyness. Could you try cron-schedule@4.0.0-next.2? The library is now ESM only and should support conditional exports with moduleResolution: "NodeNext".
The only relevant breaking change for you should be that the schedulers are no longer exposed in the default export, but need to be manually imported from cron-schedule/schedulers/interval-based.js or cron-schedule/schedulers/timer-based.js.

@drfuzzyness
Copy link
Author

Can confirm this is resolved in "cron-schedule": "^4.0.0", thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants