-
Notifications
You must be signed in to change notification settings - Fork 363
the "source" returned by "originalPositionFor" is different with "sources" of sourceMap file #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Source maps for webpack-built bundles are definitely working in Firefox. For example, this test uses one. The best thing would be if you could make a (hopefully minimal) example showing the problem. |
Here is the Source Map file:(GitHub only support uploading .txt file...) The sources field of source map:
Here is the code: const sourceMap = require('source-map');
const fs = require('fs');
const rawSourceMap = JSON.parse(fs.readFileSync('./test.txt', 'utf8'));
const smc = new sourceMap.SourceMapConsumer(rawSourceMap);
console.log(smc.originalPositionFor({
line: 1,
column: 100
})); Here is the output:
You can see that the "source" returned by "originalPositionFor" is different with "sources" of sourceMap file Thx! |
I found exactly the same problem again! @tromey here is the sourcemap file: test02.txt The sources field of source map: "webpack:///./src/components/ajax/ajax.js" Here is the code: const sourceMap = require('source-map');
const fs = require('fs');
const rawSourceMap = JSON.parse(fs.readFileSync('./test02.txt', 'utf8'));
const smc = new sourceMap.SourceMapConsumer(rawSourceMap);
console.log(smc.originalPositionFor({
line: 1,
column: 15545
})); Here is the output: { source: 'webpack:///src/components/ajax/ajax.js',
line: 14,
column: 23,
name: 'data' } |
I would mildly expect the |
The built-in URL parser can't parse that URL, which is probably the problem. Would be fixed by using the standard URL, see #275 |
This one isn't really a bug. The source-map library does some normalization. |
urlRegexp was requiring that there be no spaces in the path component of the URL. However, this is overly strict; and in particular webpack creates URLs with an embedded space. Fixes mozilla#267
urlRegexp was requiring that there be no spaces in the path component of the URL. However, this is overly strict; and in particular webpack creates URLs with an embedded space. Fixes mozilla#267
urlRegexp was requiring that there be no spaces in the path component of the URL. However, this is overly strict; and in particular webpack creates URLs with an embedded space. Fixes mozilla#267
urlRegexp was requiring that there be no spaces in the path component of the URL. However, this is overly strict; and in particular webpack creates URLs with an embedded space. Fixes mozilla#267
I use "originalPositionFor" to get the original position.
I print out the "sources" property of sourceMap and the "source" of "originalPosition" results, but they are different, making it hard for me to locate the exact "sourcesContent" of sourceMap.
sourceMap.sources:
result.source:
result.source misses "//", which is quite strange.
Any suggestion? Thx!
The text was updated successfully, but these errors were encountered: