-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Convert plugin.js to ESM because package.json has type set to module #8536
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
8b10b04
to
e9c25dd
Compare
Well, I've tried to test these changes with Vite and looks like I've completely borked my previous attempt, because it works without these changes, and also there is no JIT issue I've mentioned previously. Not sure if this PR should be closed or not, I don't think this change will do any harm, but the original issue looks like a problem on my side. Btw here's my repo with aa4+vite example, because my previous attempt was on work machine, and it's a PITA to separate from the project, so I've started from the clean state |
Reading the error message from issue again, I still think that this PR is valid, because the message states very clearly that all of the files inside npm package marked as ESM should be in ESM style and this mix and match can cause some issues. |
@4ndv thank you. We'll keep this open since it makes sense to use ESM here and to ensure compatibility with Vite. I will try to find time soon to test this locally where not using Vite. Let us know what you find out when you have time. Thanks again. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8536 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 141 141
Lines 4076 4076
=======================================
Hits 4040 4040
Misses 36 36 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Maybe of interest: after upgrading node from version 20 to 23 in a project with AA 4.0.0.beta13, I saw an error that looks different than yours but (I think) has a related reason:
Applying this PR fixed it. |
Just tested running node 23.1.0 with AA demo repo and can confirm this:
I always prefer sticking with LTS versions of node ("even" ones, 20.x, 22.x) so haven't even tested 23, thank you! Looks like the warning is caused because default |
Confirmed issue with Node 23 |
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.
Thanks!
e9c25dd
to
bdc38af
Compare
This deserves an entry in the changelog, because it also fixes compatibility with Node 23 |
@tagliala yes, it will be part of the release notes since its generated automatically based on the PR label. |
bdc38af
to
4ea6065
Compare
This PR makes
plugin.js
use ESM syntax instead of CJS, becausepackage.json
has"type": "module"
which causes issues when using bundlers.I've tested this change against activeadmin demo repo, replacing the file in node_modules, and it works fine with the oldest non-EOL version of node,
18.20.4
.Looks like autogenerated tailwind config can
require()
ESM version just fine, so probably there is no need to ship both CJS and ESM versions.Fixes #8534