Source maps don't always map back to the original sources.
See original GitHub issueDescription
Source maps don’t always map back to the original sources.
Expected/Actual behavior
Example repo: https://github.com/lydell/brunch-sources-content-bug
public/concat.css.map is correct:
{
"version": 3,
"sources": [
"app/concat1.css",
"app/concat2.css"
],
"names": [],
"mappings": "AAAA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA",
"file": "public/concat.css",
"sourcesContent": [
"a {\n color: black;\n}\n",
"b {\n font-weight: bold;\n}\n"
]
}
public/concat.js.map is correct:
{
"version": 3,
"sources": [
"app/concat1.js",
"app/concat2.js"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AACA;AADA;AAAA;CCAA;AAAA;AACA;AADA;AAAA",
"file": "public/concat.js",
"sourcesContent": [
"console.log('concat1')\n",
"console.log('concat2')\n"
]
}
public/require.js.map is wrong. It misses the “app/_hello.js” source, and the included source content is the contents of public/require.js, not of app/main.js.
{
"version": 3,
"sources": [
"app/main.js"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AACA;AACA;AAFA;AAAA",
"file": "public/require.js",
"sourcesContent": [
"var hello = require('./_hello')\nconsole.log(hello)\n"
]
}
public/sass.css.map is wrong. It misses the “app/_include.scss” source, and the included source content is the contents of public/sass.css, not of app/main.scss.
{
"version": 3,
"sources": [
"app/main.scss"
],
"names": [],
"mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA",
"file": "public/sass.css",
"sourcesContent": [
"b {\n font-weight: bold; }\n\na {\n color: black; }\n\n"
]
}
Environment
- Brunch: 2.10.2
- Node: 6.9.1
- NPM: 3.10.8
- Operating system: Ubuntu 16.04
package.json
contents
{
"private": true,
"devDependencies": {
"brunch": "^2.10.2",
"css-brunch": "^2.6.1",
"javascript-brunch": "^2.0.0",
"sass-brunch": "^2.9.0"
}
}
brunch config contents
module.exports = {
files: {
stylesheets: {
joinTo: {
'concat.css': /\.css$/,
'sass.css': /\.scss$/,
}
},
javascripts: {
joinTo: {
'concat.js': /concat\d\.js$/,
'require.js': 'app/main.js'
}
}
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:14 (4 by maintainers)
Top Results From Across the Web
4 Reasons Why Your Source Maps are Broken - Sentry Blog
This likely means that your source map doesn't contain or link to your original source files. Without your original source files, you're still ......
Read more >How to use sourcemaps to restore the original file?
Open up the source map in a text editor, and you'll see that it's mostly just a simple JSON object. The “sources” field...
Read more >508270 - Source maps cache not refreshed - chromium
When it's not "broken," the source map tabs close and come back up after reload. I suspect disabling the cache for sourcemaps somehow...
Read more >Should I Use Source Maps in Production? | CSS-Tricks
A “source map” is a special file that connects a minified/uglified version of an asset (CSS or JavaScript) to the original authored version....
Read more >Source maps in Node.js. Supporting the many flavors of…
The Source Map V3 specification. Source maps provide a method for translating from generated source back to the original, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any fixes coming down the pipes for this? Is the temporary fix to use 2.9.1?
Yep, it is.