indooorsman / esbuild-css-modules-plugin

A esbuild plugin to bundle css modules into js(x)/ts(x)
MIT License
92 stars 16 forks source link

Cannot find module '../lightningcss.linux-x64-gnu.node' #44

Closed jacob-orbiit closed 11 months ago

jacob-orbiit commented 1 year ago

An update to one of this packages' dependencies appears to have broken this package: https://github.com/parcel-bundler/lightningcss/issues/335

I see in your package.json, you're locked to lightningcss@^1.16.0: https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/package.json#L31

lightningcss recently released a patch (1.16.1), which seems likely to blame: https://github.com/parcel-bundler/lightningcss/releases/tag/v1.16.1

Pinning to 1.16.0 explicitly may resolve the issue.

indooorsman commented 1 year ago

I can't reproduce this issue on my Mac Book, could you please provide more details about your case? And if you want to lock version of lightningcss to 1.16.0 in your project, I think you could declare resolutions for yarn or overrides for npm

jacob-orbiit commented 1 year ago

It looks like pinning your dep won't matter because lightningcss were themselves not pinning their dep, which was the source of the breakage. Details are in the lightningcss PR linked in my original post (specifically https://github.com/parcel-bundler/lightningcss/issues/335#issuecomment-1320216228).

indooorsman commented 1 year ago

I've upgraded lightningcss to v1.17 which should have fixed your issue, please have a try with v2.6.3

jacob-orbiit commented 1 year ago

Fix confirmed 🙌 Than you!

jacob-orbiit commented 1 year ago

It's back (I'm on v2.7.1).

indooorsman commented 1 year ago

please try v3-dev


发件人: Jacob @.> 发送时间: Friday, August 11, 2023 5:47:54 PM 收件人: indooorsman/esbuild-css-modules-plugin @.> 抄送: indooorsman @.>; Comment @.> 主题: Re: [indooorsman/esbuild-css-modules-plugin] Cannot find module '../lightningcss.linux-x64-gnu.node' (Issue #44)

It's back (I'm on v2.7.1https://github.com/indooorsman/esbuild-css-modules-plugin/releases/tag/v2.7.1).

― Reply to this email directly, view it on GitHubhttps://github.com/indooorsman/esbuild-css-modules-plugin/issues/44#issuecomment-1674477157, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABFRA3PPXQIPOSLXCIR2J2TXUX5UVANCNFSM6AAAAAASEUMLPI. You are receiving this because you commented.Message ID: @.***>

jacob-orbiit commented 1 year ago

please try v3-dev

That seems to be totally b0rked. Not getting any errors. I see the css file is generated (and looks fine), but there are no classes in the final markup, so I'm thinking the imports are broken.

jacob-orbiit commented 1 year ago

Heads up to others: Adding the following to your package.json works around the issue (which I reported upstream https://github.com/parcel-bundler/lightningcss/issues/567)

"overrides": {
  "esbuild-css-modules-plugin": {
    "lightningcss": "1.21.3"
  }
}
indooorsman commented 1 year ago

@jacob-orbiit I see, it seems to be a bug of npm https://github.com/npm/cli/issues/4828 , please try:

rm -rf node_modules package-lock.json
npm install