-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Use ESM syntax in tailwind config template #8568
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
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.
@wrozka thank you. As you mentioned the warning will still occur. I don't know why. When reviewing tailwindcss-forms, the documentation still uses the CJS version. I would think both CJS and ESM work though. The warning could be coming from the ActiveAdmin side.
Your change does resolve the watch issue, we just need to update the template file used by our dev/test app generator. With the requested changes, the test suite should go green and the local dev app should work now.
Please open the following file and edit this single line:
activeadmin/spec/support/rails_template.rb
Line 100 in 5f4ee6c
gsub_file "tailwind-active_admin.config.js", /@activeadmin\/activeadmin/, "${activeAdminPath}" |
to the following so it will do a local require for development:
gsub_file "tailwind-active_admin.config.js", Regexp.new("@activeadmin/activeadmin/plugin"), "../../../plugin"
lib/generators/active_admin/assets/templates/tailwind.config.js
Outdated
Show resolved
Hide resolved
lib/generators/active_admin/assets/templates/tailwind.config.js
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8568 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 141 141
Lines 4076 4076
=======================================
Hits 4040 4040
Misses 36 36 ☔ View full report in Codecov by Sentry. |
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!
Fix the tailwindcss:watch bug: activeadmin/activeadmin#8568
This breaks for Rails installations that don't have a node runtime with
|
A recent syntax change in plugin.js from #8536 causes tailwind watch to break. It runs successfully on first run, but then it builds only partially - it doesn't crash, but the output files don't contain all the CSS they should.
I'm not entirely sure what causes it to break only on reloads, but the current version on tailwind config produces this warning:
This PR fixes the broken tailwind watch by migrating tailwind config from CJS to ESM, but it doesn't resolve the warning, it just moves it one level up the stack trace:
I don't think this is the final fix, but at least it fixes the watch problem.