Fix node22 lightningcss workaround#231
Conversation
There are a number of issues with lightningcss and node 22/npm. This is related to platform-/architecture-specific packages. This uses a number of pieces from multiple solutions found in the notes for colanode#160. This addresses the issues by the following measures: - Make sure npm is up-to-date in the @colanode/web Docker build - Add optional dependencies for all the platform-specific lightningcss packages that are most likely to be used in the project (HSF and mainline) in the npm project modules that require them: - @colanode/desktop - @colanode/web - @colanode/ui Closes colanode#159.
|
Hi, thanks for this. One question, do we need to include the optionalDependencies in web and desktop? Can't we keep them only in the ui package? |
|
That's a very good question! From what I gathered on all the referenced issues (in the comments of #160), anywhere @tailwindcss/postcss is a direct (prod or dev) dependency, the platform-/architecture-specific dependencies need to be explicitly declared as optional dependencies. I will verify whether this is correct. Also of note is for building/running in dev you need to make sure to update npm. I need to go look in the comments on all the referenced issues again and figure out what the fix version is for the related npm issue (npm was not managing optional dependencies correctly earlier this year) and will add that as a comment here. |
|
The npm fix version is 11.3.0, so if you have 10.x or an older 11.x version, the new/fixed optionalDependencies management code is not present. Tailwind only fixed the error for oxide, not for lightningcss, which is why this is necessary. |
ff28b76 to
f2eb633
Compare
|
Your sense was correct in that the platform-/architecture-specific dependencies are only required in @colanode/ui to allow the build to not break. |
|
Does this look okay to you? |
I corrected the version field being moved unnecessarily. |
|
@eljonny thanks for the updates. One last question, if this is mainly for the web, would it work if we include the dependencies only in the web app? |
|
Hey @hakanshehu! This is equally for @colanode/desktop. I have seen this in quite a wide variety of environments. |
|
@eljonny ah okay, I didn't personally experience it (I use Mac). Anyway, looks good, merging it. Thanks a lot! |
|
Thank you for all your work on this wonderful piece of software!! It has been super useful for me, and so grateful I can help, albeit minimally. |
There are a number of issues with lightningcss and node 22/npm.
This is related to platform-/architecture-specific packages.
This uses a number of pieces from multiple solutions found in the notes
for #160.
This addresses the issues by the following measures:
packages that are most likely to be used in the project in the npm project modules that require them:
Closes #159.
Tested build success in: