You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ npm run build
[Error: failed to read input source map from user-provided sourcemap
Caused by:
bad reference to source#299] {
code: 'GenericFailure'
}
Input code
No response
Config
import{transform}from'@swc/core';importfsfrom"node:fs";constfileCode=fs.readFileSync("./a.js","utf-8");constfileMap=fs.readFileSync("./a.js.map","utf-8");// valid check https://evanw.github.io/source-map-visualization/// transformed successfullyconstresult=awaittransform(fileCode,{filename: 'a.js',sourceMaps: true,inputSourceMap: fileMap,jsc: {target: 'es5'},module: {type: "commonjs",strictMode: false},})// fs.writeFileSync("./a.transformed.js", result.code);// fs.writeFileSync("./a.transformed.js.map", result.map);// Using the result again to transform throws an error// and verification failed in https://evanw.github.io/source-map-visualization/awaittransform(result.code,{filename: "a.js",// minify: true,sourceMaps: true,inputSourceMap: result.map,// jsc: {// target: "es5",// minify: {// compress: {// inline: 0,// drop_debugger: false,// passes: 1,// },// mangle: {// toplevel: false,// keep_classnames: false,// keep_fnames: false,// keep_private_props: false,// ie8: false,// safari10: false,// },// format: {// asciiOnly: true,// wrapIife: true,// },// },// },module: {type: "commonjs",strictMode: false},}).catch((e)=>{/** * [Error: failed to read input source map from user-provided sourcemap * * Caused by: * bad reference to source #299] { * code: 'GenericFailure' * } */console.log(e);});
Playground link (or link to the minimal reproduction)
noyobo
changed the title
tansform providing an inputSourceMap throws an error [bad reference to source #299]
transform providing an inputSourceMap throws an error [bad reference to source #299]
Mar 28, 2024
Describe the bug
https://stackblitz.com/~/github.com/noyobo/swc-issues
Input code
No response
Config
Playground link (or link to the minimal reproduction)
https://stackblitz.com/~/github.com/noyobo/swc-issues
SWC Info output
No response
Expected behavior
The transformed sourceMap content can be used again
Actual behavior
No response
Version
1.4.11
Additional context
No response
The text was updated successfully, but these errors were encountered: