Skip to content

Fix node22 lightningcss workaround#231

Merged
hakanshehu merged 5 commits into
colanode:mainfrom
eljonny:fix-node22-lightningcss-workaround
Nov 4, 2025
Merged

Fix node22 lightningcss workaround#231
hakanshehu merged 5 commits into
colanode:mainfrom
eljonny:fix-node22-lightningcss-workaround

Conversation

@eljonny

@eljonny eljonny commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

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:

  • 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 in the npm project modules that require them:
    • @colanode/desktop
    • @colanode/web
    • @colanode/ui

Closes #159.

Tested build success in:

  • @colanode/desktop
    • linux-x64-gnu
    • win32-x64-msvc
  • @colanode/ui
    • linux-x64-gnu
    • win32-x64-msvc
  • @colanode/web
    • linux-x64-gnu
    • win32-x64-msvc
    • node22/alpine docker container (linux-x64-musl)

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.
@hakanshehu

Copy link
Copy Markdown
Contributor

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?

@eljonny

eljonny commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

That's a very good question!
I do not know the answer, and I will do some testing to see if that works which would simplify this PR.

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.

@eljonny

eljonny commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

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.
This is the corresponding and related npm issue: npm/cli#8184

Tailwind only fixed the error for oxide, not for lightningcss, which is why this is necessary.
lightningcss is built and maintained by Parcel: https://github.com/parcel-bundler/lightningcss and Oxide is maintained by tailwind.

@eljonny eljonny force-pushed the fix-node22-lightningcss-workaround branch from ff28b76 to f2eb633 Compare October 19, 2025 07:02
@eljonny

eljonny commented Oct 19, 2025

Copy link
Copy Markdown
Contributor Author

Your sense was correct in that the platform-/architecture-specific dependencies are only required in @colanode/ui to allow the build to not break.
I've pushed a commit that reduces the specification of those dependencies.

@eljonny

eljonny commented Oct 26, 2025

Copy link
Copy Markdown
Contributor Author

Does this look okay to you?
I noticed the moving around of the version property in @colanode/web package.json, that is unnecessary, I will fix it.

@eljonny

eljonny commented Oct 31, 2025

Copy link
Copy Markdown
Contributor Author

I noticed the moving around of the version property in @colanode/web package.json, that is unnecessary, I will fix it.

I corrected the version field being moved unnecessarily.
@hakanshehu lgty?

@hakanshehu

Copy link
Copy Markdown
Contributor

@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?

@eljonny

eljonny commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

Hey @hakanshehu! This is equally for @colanode/desktop.
They both suffer from the issue because they both use @colanode/ui with tailwind.

I have seen this in quite a wide variety of environments.
Have you not run into this at all?
Alpine, Ubuntu, and Windows have all demonstrated this behavior in my experience, all with the corresponding platform-/C-library-/architecture-specific package missing.

@hakanshehu

Copy link
Copy Markdown
Contributor

@eljonny ah okay, I didn't personally experience it (I use Mac). Anyway, looks good, merging it. Thanks a lot!

@hakanshehu hakanshehu merged commit 316a388 into colanode:main Nov 4, 2025
@eljonny

eljonny commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

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.

@eljonny eljonny deleted the fix-node22-lightningcss-workaround branch November 10, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[selfhost] [web] Issues with the @colanode/web build process

2 participants