-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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(build): Fix ESM output (#7357) #7358
base: main
Are you sure you want to change the base?
Conversation
This prevents Babel from converting the ESM module syntax to CommonJS.
Otherwise a "clean" build will still use old artefacts from the cache.
This ensures that any local dependencies are built first.
Thanks to the other changes in this PR, we can now safely import from the decap-cms-app.
This will hopefully fix the error we get on Windows during `npm install`
I noticed that the GitHub action is failing during |
@fgnass Yes, sometimes the tests fail for no reason, so we must re-run them. Thanks for the fix! |
Okay, the installation step now seems to work reliably, but the e2e tests failed, I guess because the files in |
@fgnass ubuntu + node 20 is still failing |
I'll look into it and try to reproduce the error in my forked repo. Stay tuned. |
Good news: The workflow did run successfully in my forked repo: https://github.com/fgnass/decap-cms/actions/runs/12483114867/job/34838341976 I'm curious if it will succeed here too! |
FWIW, I was looking at this from the "module": "dist/esm/index.js", I think it should - then you wouldn't have to update your Also, somewhat unrelated, but "decap-cms-backend-gitea": "^3.1.5", Thanks for the work on this PR, it's much more extensive than what I had explored so far. |
@dragons-library Good catch! I added the module field and the missing dependency. |
Summary
This PR fixes two related issues discovered while working on ESM builds:
ESM builds incorrectly output CommonJS format despite being in
dist/esm
directories. This happens because Babel's preset-env transforms ES modules to CommonJS by default. The issue can be seen in decap-cms-core's ESM build.Build dependencies are not properly configured in Nx, causing builds to fail with empty cache as packages are built in parallel without respecting dependencies.
Changes:
modules: false
for ESM buildsnx.json
to ensure correct build orderdist/esm
in favor of proper package entry pointsFixes #7357
Test plan
dist/esm/index.js
:Checklist
A picture of a cute animal