-
-
Notifications
You must be signed in to change notification settings - Fork 781
Description
System Info
System:
OS: macOS 15.0.1
CPU: (10) arm64 Apple M1 Max
Memory: 1.92 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.16.0 - ~/.local/state/fnm_multishells/79899_1729519945071/bin/node
npm: 10.8.1 - ~/.local/state/fnm_multishells/79899_1729519945071/bin/npm
pnpm: 9.12.2 - ~/.local/state/fnm_multishells/79899_1729519945071/bin/pnpm
Browsers:
Chrome: 130.0.6723.59
Safari: 18.0.1
npmPackages:
@rspack/cli: 1.0.13 => 1.0.13
@rspack/core: 1.0.13 => 1.0.13
@rspack/plugin-react-refresh: 1.0.0 => 1.0.0
Details
In attempt to migrate from webpack I stumbled upon the following error that is a little bit hard to trace, but the root cause is the following:
ts-loader allows to provide options.getCustomTransformers as function.
{
test: /\.tsx?$/,
loader: 'builtin:swc-loader',
type: 'javascript/auto',
options: {
getCustomTransformers: () => {}
...
...
Starting the web server results in the following error:
/Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:17883
this.#instance = new instanceBinding.Rspack(
^
Error: JS functions cannot be represented as a serde_json::Value
at _Compiler.#getInstance (/Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:17883:22)
at _Compiler.#build (/Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:17330:22)
at /Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:17302:18
at done (/Users/user/PATH/node_modules/.pnpm/@rspack+lite-tapable@1.0.1/node_modules/@rspack/lite-tapable/dist/index.js:473:13)
at AsyncSeriesHook.callAsyncStageRange (/Users/user/PATH/node_modules/.pnpm/@rspack+lite-tapable@1.0.1/node_modules/@rspack/lite-tapable/dist/index.js:480:20)
at AsyncSeriesHook.callAsync (/Users/user/PATH/node_modules/.pnpm/@rspack+lite-tapable@1.0.1/node_modules/@rspack/lite-tapable/dist/index.js:82:21)
at _Compiler.compile (/Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:17296:30)
at /Users/user/PATH/node_modules/.pnpm/@rspack+core@1.0.13/node_modules/@rspack/core/dist/index.js:16733:21
at done (/Users/user/PATH/node_modules/.pnpm/@rspack+lite-tapable@1.0.1/node_modules/@rspack/lite-tapable/dist/index.js:473:13)
at next (/Users/user/PATH/node_modules/.pnpm/@rspack+lite-tapable@1.0.1/node_modules/@rspack/lite-tapable/dist/index.js:533:25) {
code: 'InvalidArg'
}
Is it possible to improve error message here?
Reproduce link
https://github.com/skoch13/rspack-repro
Reproduce Steps
- add function inside of
Rule.options - execute
rspack serve
or check repro at https://github.com/skoch13/rspack-repro