Skip to content
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

InvalidMappingColumn for mapped eol. #179

Closed
mbehzad opened this issue Mar 25, 2020 · 3 comments
Closed

InvalidMappingColumn for mapped eol. #179

mbehzad opened this issue Mar 25, 2020 · 3 comments
Labels

Comments

@mbehzad
Copy link

mbehzad commented Mar 25, 2020

Description
Sometimes during compilation of files, some plugins will add an eol to the end of the output. e.g. mini-css-extract-plugin. During the source-map generation (e.g. by mozilla/source-map) a new segment will be added for the line ending without a reference to the original source (probably because the eol didn't come from the source). Which according to the source-map spec, segments with only one variable are allowed.

source-map-explorer when reading such a source-map throws InvalidMappingColumn error with the message:

Your source map refers to generated column 15 on line 1, but the source only contains 14 column(s) on that line. Check that you are using the correct source map.

might be related to #136

Steps to reproduce

css:

body{margin:0}

/*# sourceMappingURL=output.css.map*/

source-map:

{"version":3,"sources":["webpack:///main.css"],"names":[],"mappings":"AAAA,KAAK,QAAQ,C","file":"css/output.css","sourcesContent":["body{margin:0}"],"sourceRoot":""}

run source-map-explorer with these files

Files to reproduce
minimal repo: https://github.com/mbehzad/webpack-postcss-cssnano-source-map-issue

Expected behavior
it would be great if source-map-explorer could detect that the column number bing one bigger that the line length and having no reference for the original source is because of a eol and ignore it.

Environment

  • OS: windows 10
  • node: 12.13.0
  • source-map-explorer Version : 2.4.1

Additional context
output was generated by a webpack build using mini-css-extract-plugin and the css file was minified prior / as part of that.

@nikolay-borzov nikolay-borzov added this to the 2.4.2 milestone Mar 28, 2020
@nikolay-borzov nikolay-borzov self-assigned this Mar 28, 2020
@nikolay-borzov
Copy link
Collaborator

I don't think it's possible to detect that source map reference EOL when sourcesContent doesn't contain the EOL. Described mini-css-extract-plugin behavior looks like a bug. mini-css-extract-plugin should not generate mapping for EOL.
I'm thinking about disabling column/line boundaries check when analyzing a source map. These checks can be useful but they bring more troubles.

@nikolay-borzov nikolay-borzov removed this from the 2.4.2 milestone Mar 28, 2020
@nikolay-borzov nikolay-borzov removed their assignment Mar 28, 2020
@nikolay-borzov
Copy link
Collaborator

Use --no-border-checks to disable invalid mapping column/line checks

@mbehzad
Copy link
Author

mbehzad commented Mar 30, 2020

thank you very much for the fast response!

mbehzad added a commit to mbehzad/fe-tools that referenced this issue Mar 30, 2020
rexdev0211 pushed a commit to rexdev0211/pv-fe-tools that referenced this issue Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants