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
{{ message }}
This repository was archived by the owner on Oct 2, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 2, 2021. It is now read-only.
There's a bug in gulp-sourcemaps < 2.0.0-alpha where it uses sourceRoot: /source/ by default. This impacts ionic, the ionic2 beta so far, and anyone else using gulp-sourcemaps directly or indirectly. The result is that the file path data in the sourcemap is simply wrong, but the source content is inlined, so it doesn't matter for browser devtools.
In the Ionic case, I honestly can't figure out how to set the sourceRoot from the gulpfile. But it would be really easy to have an option in the launch config to override the sourceRoot globally or for app.bundle.js.
Ignore this, I ended up doing it differently
"sourceRoot": "${workspaceRoot}"
...
"sourceRoot": "/.." // Looks like nonsense but the proper sourceRoot for the default Ionic2 config is the directory above the webRoot
...
"sourceRoot": {
"bundle.js.map": "${workspaceRoot}",
"bundle*": "${workspaceRoot}",
"somethingElse.js.map": "c:\\project\\src"
}
Obviously it's better to fix your build config but this might be nice to get us through this gulp-sourcemaps bug, maybe combined with better logging and optional webRoot.
webpack and meteor also need the sources entries to be modified. And it would be great if this was doable without actually reading the sourcemap file. So it might make sense to have mappings for full paths, not sourceRoot or some other individual property.
These would be applied after doing the 'sourceRoot' + 'sources' operation. After applying the mapping, it would continue to be resolved as usual relative to the sourcemap location or webRoot, if needed.
On the right hand side of a mapping, "/something" is interpreted as a local path, not a path on the url, because there's no way to tell the difference. But on the left, "/something" is interpreted as a path from the url. What would we do when the right side is not an absolute path? I don't know what would make sense. So the right side should be required to be an absolute path.
"sourceMapSourceOverrides": {
"webpack:///*": "${workspaceRoot}/*", // Remove webpack://
"webpack:///*": "${webRoot}/*", // Remove webpack://, resolve relative to webRoot
"meteor:///<pc emoji>app/*": "*", // Remove meteor:///
"/source/*": "${workspaceRoot}/*", // Remove source/
"/dist/app/main.js": "${workspaceRoot}/../project/app/main.js", // Replace exact match to local path outside of workspaceRoot
"main.js": "c:/project/app/main.js", // windows absolute path
"main.js": "/project/app/main.js", // unix-style absolute path
"main.js": "http://localhost/main.js", // invalid
"*/app.js": "/project/src/app.js" // match app.js in any folder
}
Users can determine what the left side should be by looking at the path in Chrome DevTools.
We have the sources, sourceRoot, webRoot, and overrides.
For each source entry:
If there's a sourceRoot specified in the sourceMap, prepend that to the sources entry. Test the result against the overrides. If something was applied, done.
If it starts with file:///, remove file:/// and return that.
Combine the source entry with the computed sourceRoot and return that.
'computed sourceRoot' meaning code in sourceMapUtils.getAbsSourceRoot - produce an absolute local path which is computed from the sourceRoot, webRoot, and the location of the script, as needed.
Activity
roblourens commentedon Jul 7, 2016
webpack and meteor also need the sources entries to be modified. And it would be great if this was doable without actually reading the sourcemap file. So it might make sense to have mappings for full paths, not sourceRoot or some other individual property.
These would be applied after doing the 'sourceRoot' + 'sources' operation. After applying the mapping, it would continue to be resolved as usual relative to the sourcemap location or webRoot, if needed.
On the right hand side of a mapping, "/something" is interpreted as a local path, not a path on the url, because there's no way to tell the difference. But on the left, "/something" is interpreted as a path from the url. What would we do when the right side is not an absolute path? I don't know what would make sense. So the right side should be required to be an absolute path.
Users can determine what the left side should be by looking at the path in Chrome DevTools.
roblourens commentedon Jul 7, 2016
We have the sources, sourceRoot, webRoot, and overrides.
For each source entry:
file:///, removefile:///and return that.sourceMapUtils.getAbsSourceRoot- produce an absolute local path which is computed from the sourceRoot, webRoot, and the location of the script, as needed.Support 'sourceMapSourceOverrides' option
mvidailhet commentedon Dec 7, 2016
OK, so after running on the same problems trying to debug our Ionic App, I had to add these lines to make it work:
It seems that the launch.json uses
cwdinstead ofwebRoot