Skip to content

[Bug]: error: invalid utf-8 sequence of 1 bytes from index xxx #8006

@littleprincewdk

Description

@littleprincewdk

System Info

System:
OS: macOS 14.5
CPU: (12) arm64 Apple M3 Pro
Memory: 138.08 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.3 - ~/.nvm/versions/node/v18.20.3/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.3/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v18.20.3/bin/npm
pnpm: 9.7.1 - ~/.yarn/bin/pnpm
Browsers:
Chrome: 129.0.6668.60
Safari: 17.5
npmPackages:
@rspack/cli: ^1.0.7 => 1.0.7
@rspack/core: ^1.0.7 => 1.0.7

Details

遇到了一个异常错误
image

src/bad.js 有非 utf8 字符,rspack buildin:swc-loader 不能处理,但是 webpack 或 swc-loader 是可以的。如果我只是在 vscode 里保存下这个文件(不做任何修改)后(src/good.js),buildin:swc-loader 也可以了。对比发现非 utf8 字符被 vscode 替换成了 "efbfbd",即 替代字符 (U+FFFD)
image
image

希望 buildin:swc-loader 像 babel/swc 一样去兼容一下

复现代码:rspack-project.zip

Reproduce link

No response

Reproduce Steps

  1. pnpm install
  2. prpm run dev
### Tasks

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpending triageThe issue/PR is currently untouched.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions