rspack
rspack copied to clipboard
[Bug Report]: typeof sourcemap passed to loader is string, expect object
System Info
System: OS: Linux 5.4 Debian GNU/Linux 11 (bullseye) 11 (bullseye) CPU: (8) x64 Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz Memory: 7.01 GB / 15.40 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm npmPackages: @rspack/cli: ^0.1.0 => 0.1.0
Details
When I try to use babel-loader after another loader, it reports an error:
Error: .inputSourceMap must be a boolean, object, or undefined
Reproduce link
No response
Reproduce Steps
// rspack.config.js
/** @return {import('@rspack/cli').Configuration} */
module.exports = () => {
return {
module: {
rules: [
{
test: /\.js$/,
use: './loader-b',
},
{
test: /\.js$/,
use: './loader-a',
},
],
},
};
};
// loader-a.js
module.exports = function (source, map, meta) {
this.callback(null, source, {}, meta);
return;
};
// loader-b.js
module.exports = function (source, map, meta) {
console.log(typeof map); // <------ it prints `object` in webpack, but got `string` in rspack
this.callback(null, source, map, meta);
return;
};