-
Notifications
You must be signed in to change notification settings - Fork 11
feat: dual (native) ESM/CJS support all the packages #312
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
Conversation
I guess we should require node 14 and ship major versions of everything |
Ouch... Shapeshift is node 16+ only it seems... I thought nodejs 14 also had it. Might have to either experiment with ow or make shapeshift compatible with node 14 |
Personally i dont mind node 16 either, those are internal packages so as long as we run things on node 16 internally… but i am not sure about that tbh, i would expect older version |
I think a huge chunk internally is still on node 14, so yeah.. will have to look into this |
Misread the stack, its the |
We made shapeshift be nodejs 14+ compatible, and I feel like we could drop the nodejs 12 CI here, especially since it's no longer even supported by node. Thoughts? |
If platform depends in any way on the ow errors, it will break something. Otherwise it should just work the same, but I do wonder if it can be tested somehow 👀 |
Platform uses Meteor which uses its own transpilation. Anything can go wrong 😀 |
@vladfrangu @mnmkng So what's actually the goal of this PR? Would be nice to get some short description of what has changed instead of just a review request out of the blue, so we don't have to play detective across 43 changed files. |
@fnesveda It's a change to use native ESM imports and modules instead of CJS AFAIK. I added you because I had no idea if Platform even supports ESM. |
The PR makes all the modules in here dual-compile to ESM and CJS, to provide native ESM for those that use ESM instead of a light wrapper with gen-esm-wrapper. It shouldn't change anything in terms of code execution, platform will probably still import the CJS file (we can also build browser compatible bundles if it helps at all, to have them globally available via ApifyConstants for example) if it respects the package.json export declarations 😄 |
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.
If it still builds CJS versions as well, and they are the default under main
in package.json
, then it should be importable / requireable on the platform.
We'll just have to change a few imports since all the files are now bundled, and we can't import from them directly, but nothing major.
Could you release this as a major version, just to make sure we don't accidentally update the packages with Renovate bot etc.?
Also CC @jbartadev we'll probably have to update web to Node 14+ because of this (and other reasons). |
Errors that don't appear in editor..yay
Let's see how it works... 🤞 |
Looks like it works fine, already added to crawlee, E2E tests are passing including on platform. |
While all the compiled code looks fine and functional, testing would still be needed to ensure it still works correctly