Example with React
vomc opened this issue · 0 comments
vomc commented
Hi,
I am wondering if someone could help me understand how I would use this with React. I have an app that I created using create-react-app
and have now enabled source maps in my build process. For me this results in 3 files that are generated
main.a7bcdc4c.chunk.js.map
2.0f92efcc.chunk.js.map
runtime-main.886132ac.js.map
I have introduced an error into my built app and have gotten a stack trace which locates this error to line 2 in main.a7bcdc4c.chunk.js.map
at column 4032779.
Looking at the docs I expected that if I pass this information to the tool in the form of:
const srcMap = fs.readFileSync('./path/to/my/file/2.0f92efcc.chunk.js.map').toString()
const consumer = await new sourceMap.SourceMapConsumer(srcMap);
const pos = consumer.originalPositionFor({ line: 2, column: 4032779 });
That I would see the position in the original src, however the result is just { source: null, line: null, column: null, name: null }
Any tips on what I am doing incorrectly would be appreciated
Thanks