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
I wanted to verify my source maps locally and went through this guide.
I installed source-map globally with npm install -g source-map
Then I lunched:
const fs = require('fs');
const path = require('path');
const sourceMap = require('source-map');
// Path to file that is generated by your build tool (webpack, tsc, ...)
const GENERATED_FILE = path.join(
'.',
'/platformBuilds/dai_web/.next/static/chunks/pages/_app-9c6cc7df74562253.js.map'
);
// Line and column located in your generated file (for example, the source
// of the error from your minified file)
const GENERATED_LINE_AND_COLUMN = { line: 1, column: 10 };
const rawSourceMap = fs.readFileSync(GENERATED_FILE).toString();
// console.log('+++ rawSourceMap', rawSourceMap);
new sourceMap.SourceMapConsumer(rawSourceMap).then((smc) => {
const pos = smc.originalPositionFor(GENERATED_LINE_AND_COLUMN);
// You should see something like:
// { source: 'original.js', line: 57, column: 9, name: 'myfunc' }
console.log(pos);
});
But I get Error:
new sourceMap.SourceMapConsumer(rawSourceMap).then((smc) => {
^
TypeError: (intermediate value).then is not a function
at Object.<anonymous> (/Users/user/Projekty/prdai/smtest.js:20:47)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I wanted to verify my source maps locally and went through this guide.
I installed source-map globally with
npm install -g source-map
Then I lunched:
But I get Error:
How can I solve it?
Beta Was this translation helpful? Give feedback.
All reactions