web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
9.87k stars 571 forks source link

[Bug]: lightningcss color internal error #7789

Open beliefgp opened 2 months ago

beliefgp commented 2 months ago

System Info

System: OS: macOS 14.5 CPU: (8) arm64 Apple M3 Memory: 16.00 GB Binaries: Node: 18.20.4 npm: 10.7.0 pnpm: 9.9.0 Browsers: Chrome: 128.0.6613.114

Details

import 'pdfjs-dist/web/pdf_viewer.css';

lightningcss throw error when use pdf_viewer.css. webpack is ok.

Message: internal error: entered unreachable code Location: index.crates.io-6f17d22bba15001f/lightningcss-1.0.0-alpha.58/src/values/color.rs:3225

Reproduce link

No response

Reproduce Steps

rsbuild build

JSerFeng commented 2 months ago

webpack is ok.

Did you use this loader ?

JSerFeng commented 2 months ago

Can you try add a targets config to it, I tried and compiled successfully, I'm not sure if this is a bug of lightningcss

beliefgp commented 2 months ago

i use rsbuild, enable lightningcss.

// rsbuiild.config.ts

import { defineConfig } from '@rsbuild/core';

export default defineConfig({
  source: {
    entry: {
      main: './src/index.ts'
    }
  }
});

// src/index.ts

import 'pdfjs-dist/web/pdf_viewer.css';

There are still error: Message: internal error: entered unreachable code Location: index.crates.io-6f17d22bba15001f/lightningcss-1.0.0-alpha.58/src/values/color.rs:3225

iwtem commented 1 month ago

同样遇到了类似的问题

> 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.
iwtem commented 1 month ago

找到了一个解决方法,但是不清楚具体原因,发现把 output.copy 这个配置去掉,就可以打包成功。

iwtem commented 1 month ago

找到了一个解决方法,但是不清楚具体原因,发现把 output.copy 这个配置去掉,就可以打包成功。

具体见:https://github.com/web-infra-dev/rspack/issues/8017