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
fix: export cjs and es #1298
fix: export cjs and es #1298
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not an expert on module/exports etc. therefore I yield to other people.
But I added note for people migrating from @types/agenda
For Typescript, Webpack or other module imports, use `agenda/es` entrypoint: | ||
e.g. | ||
```ts | ||
import { Agenda } from 'agenda/es'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make a note that people migrating from @types/agenda should change their imports
from: import Agenda from 'agenda'
to: import { Agenda} from 'agenda/es'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added it to the readme
Couldn't you just add export = Agenda In index.ts |
Unfortunately not, this would overwrite all other exports and would therefore not work correctly. It would only fix the plain JS includes, but this does my PR too. |
…estructuring. Update README a bit.
Thanks for the additional fixes and tests! Lgtm too, feel free to merge |
as commented in #1266, this one would restore the old behaviour and introduces a new entrypoint for es modules.
for CJS (javascript):
const Agenda = require('agenda');
or for module (typescript):
import Agenda from 'agenda/es'
This is a "another" breaking change though, as a named import would not work with the default entrypoint anymore (didn't work before, but did now in the patch releases)