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
And if you open the page in Chrome (http://example.com/dist), open Developer Tools > Elements tab. Click on inner div, you'll see:
Now, if you comment out lines marked with (1), and uncomment the one marked with (2), run webpack, you'll get the following mappings (in bundle.js, search for word mappings):
AAAA,IACI,UAAY,CAIf,AALD,QAGQ,UAAY,CACf
([0,0](#0)=>[0,0])
| ([1,4](#0)=>[0,4])
| ([1,16](#0)=>[0,14])
| ([5,1](#0)=>[0,15])
| ([0,0](#0)=>[0,15]) // source-map removes this
| ([3,8](#0)=>[0,23])
| ([3,20](#0)=>[0,33])
| ([4,5](#0)=>[0,34]) // and this lines
and the following line in Chrome:
Which is arguably correct. Anyways, line 6 doesn't even come close to it.
I'm not sure if this is okay, or not. The spec is not strict (what I can understand). Everybody has their own idea of what is acceptable. So feel free to close the PR.
For browsers these days it doesn't matter much. They learned to use the mapping after the opening bracket (div div{), from what I can gather.
x-yuri
changed the title
source-map changes source map when it probably shouldn't
source-map omits some mappings when regenerating source map
Jan 27, 2018
See next post for a lower level case.
I hope you don't mind me explaining how to reproduce the issue with
webpack
:package.json
:webpack.config.js
:template.ejs
:1.js
:1.scss
:With
extract-text-webpack-plugin
(1) you get source map indist/main.css.map
and the following mappings:And if you open the page in Chrome (http://example.com/dist), open
Developer Tools
>Elements tab
. Click on innerdiv
, you'll see:Now, if you comment out lines marked with
(1)
, and uncomment the one marked with(2)
, runwebpack
, you'll get the following mappings (inbundle.js
, search for wordmappings
):and the following line in Chrome:
Which is arguably correct. Anyways, line 6 doesn't even come close to it.
Now, if you change
node_modules/webpack/lib/SourceMapDevToolPlugin.js
like so:you'll see:
sourceAndMap()
function is defined here. And here's where it passes control tosource-map
package.Having that said, we can see that source map was changed, for no clear reason. Can you explain it? This seems like a bug in
source-map
.Files needed to reproduce it with Webpack 3
The text was updated successfully, but these errors were encountered: