Report `Invalid mapping` error when map's mappings is empty.
Closed this issue · 1 comments
creeperyang commented
An empty source map generated by gulp-sourcemaps init
:
{ version: 3,
names: [],
mappings: '',
sources: [ 'css/unusual.css' ],
sourcesContent: [ '.box-title {\n background-image: url(\n "../img/y.png"\n );\n}' ],
file: 'css/unusual.css' }
Then got error:
Error: Invalid mapping: {"generated":{"line":1,"column":0},"source":null,"original":{"line":null,"column":null},"name":null}
SourceMapGenerator_validateMapping [as _validateMapping] (node_modules/.0.5.6@source-map/lib/source-map-generator.js:277:13)
creeperyang commented
Empty source map is one of the reasons will lead to this error. So I reopen this issue.
As we know, postcss
parse css to ast and generate source map. And the generated source map could be more detailed than previous map. When the previous line may ignored last line and postcss
wont, error occurs.
So we should check it more carefully.