Skip to content
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

[Bug]: CSS files in the public directory will cause the build to fail #8017

Open
iwtem opened this issue Sep 29, 2024 · 2 comments
Open

[Bug]: CSS files in the public directory will cause the build to fail #8017

iwtem opened this issue Sep 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@iwtem
Copy link

iwtem commented Sep 29, 2024

Version

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 1.80 GB / 4.01 GB
    Container: Yes
    Shell: Unknown
  npmPackages:
    @rsbuild/core: 1.0.7 => 1.0.7 
    @rsbuild/plugin-react: 1.0.2 => 1.0.2

Details

这两天将 rsbuild 从 0.7.3 升级到 1.0.7 最后一个版本,正常本地开发没什么问题,在执行 rsbuild build 命令进行打包的时候一直报错,错误如下:

> RUST_BACKTRACE=full rsbuild build
  Rsbuild v1.0.7

Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues
Message:  internal error: entered unreachable code
Location: index.crates.io-6f17d22bba15001f/lightningcss-1.0.0-alpha.58/src/values/color.rs:3225
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 1: _napi_register_module_v1
    at <unknown source file>
 2: _napi_register_module_v1
    at <unknown source file>
 3: _napi_register_module_v1
    at <unknown source file>
 4: _napi_register_module_v1
    at <unknown source file>
 5: _wasmer_vm_f64_nearest
    at <unknown source file>
 6: _wasmer_vm_f64_nearest
    at <unknown source file>
 7: _blake3_compress_in_place_portable
    at <unknown source file>
 8: _blake3_compress_in_place_portable
    at <unknown source file>
 9: _blake3_compress_in_place_portable
    at <unknown source file>
10: _blake3_compress_in_place_portable
    at <unknown source file>
11: _blake3_compress_in_place_portable
    at <unknown source file>
12: _blake3_compress_in_place_portable
    at <unknown source file>
13: _blake3_compress_in_place_portable
    at <unknown source file>
14: _blake3_compress_in_place_portable
    at <unknown source file>
15: _blake3_compress_in_place_portable
    at <unknown source file>
16: _napi_register_module_v1
    at <unknown source file>
17: _napi_register_module_v1
    at <unknown source file>
18: _napi_register_module_v1
    at <unknown source file>
19: _napi_register_module_v1
    at <unknown source file>
20: _napi_register_module_v1
    at <unknown source file>
21: _napi_register_module_v1
    at <unknown source file>
22: _napi_register_module_v1
    at <unknown source file>
23: _napi_register_module_v1
    at <unknown source file>
24: _napi_register_module_v1
    at <unknown source file>
25: _napi_register_module_v1
    at <unknown source file>
26: _wasmer_vm_f64_nearest
    at <unknown source file>
27: _napi_register_module_v1
    at <unknown source file>
28: _napi_register_module_v1
    at <unknown source file>
29: _napi_register_module_v1
    at <unknown source file>
30: _napi_register_module_v1
    at <unknown source file>
31: _napi_register_module_v1
    at <unknown source file>
32: _napi_register_module_v1
    at <unknown source file>
33: _napi_register_module_v1
    at <unknown source file>
34: _wasmer_vm_f64_nearest
    at <unknown source file>
35: _napi_register_module_v1
    at <unknown source file>
36: _napi_register_module_v1
    at <unknown source file>
37: _napi_register_module_v1
    at <unknown source file>
38: __pthread_deallocate
    at <unknown source file>
 ELIFECYCLE  Command failed.

一直以为是 lightningcss 的问题,但是把 lightningcss loader 禁用掉仍然报这个错误。经过一番努力发现把 rsbuild 配置中的 output.copy 去掉,打包就成功了,然后继续排查该目录,最终锁定在某个 css 文件中的几行代码,去掉 color-mix 那行即可打包成功。

.textLayer ::selection{
  background:rgba(0 0 255 / 0.25);
  background:color-mix(in srgb, AccentColor, transparent 75%);
}

但是 public 目录不是单纯的复制吗,也会经过编译这一步骤?

Reproduce link

https://codesandbox.io/p/devbox/4wyjt5

Reproduce Steps

  1. 打开控制台
  2. 执行 pnpm build
@iwtem
Copy link
Author

iwtem commented Sep 29, 2024

当然不局限于打包这个命令,正常的本地开发,在 css 中添加上述出现问题的样式,同样也会报一样的错误。

@chenjiahan chenjiahan changed the title [Bug]: public 目录下的 css 文件,会导致 build 失败 [Bug]: CSS files in the public directory will cause the build to fail Sep 29, 2024
@chenjiahan chenjiahan transferred this issue from web-infra-dev/rsbuild Sep 29, 2024
@chenjiahan chenjiahan added the bug Something isn't working label Sep 29, 2024
@chenjiahan
Copy link
Member

There are two issues here:

  • The copied module should not be processed by lightningcss.
  • Lightningcss should not panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants