Closed romainmenke closed 7 months ago
Related issue in original repo : https://github.com/mozilla/source-map/issues/385
Stacktrace of the error:
00:47:03 Error: [postcss] original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
00:47:03 at SourceMapGenerator.SourceMapGenerator_validateMapping [as _validateMapping] (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/lib/source-map-generator.js:276:15)
00:47:03 at SourceMapGenerator.SourceMapGenerator_addMapping [as addMapping] (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/lib/source-map-generator.js:110:12)
00:47:03 at /home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/lib/source-map-generator.js:72:17
00:47:03 at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/lib/source-map-consumer.js:155:7)
00:47:03 at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/source-map-js@1.0.2/node_modules/source-map-js/lib/source-map-generator.js:48:24)
00:47:03 at MapGenerator.generateMap (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/postcss@8.4.33/node_modules/postcss/lib/map-generator.js:101:37)
00:47:03 at MapGenerator.generate (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/postcss@8.4.33/node_modules/postcss/lib/map-generator.js:85:19)
00:47:03 at new NoWorkResult (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/postcss@8.4.33/node_modules/postcss/lib/no-work-result.js:33:46)
00:47:03 at Processor.process (/home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/postcss@8.4.33/node_modules/postcss/lib/processor.js:51:14)
00:47:03 at runPostcss (file:///home/jenkins/workspace/Geiger/geiger-upgrade-deps/node_modules/.pnpm/vite@4.5.0_@types+node@18.16.16_less@4.2.0/node_modules/vite/dist/node/chunks/dep-e4a495ce.js:287:6) {
00:47:03 code: 'PLUGIN_ERROR',
00:47:03 loc: { column: undefined, line: undefined },
Hey guys! We discussed it a bit in private with @ai and @alexander-akait
Alexander said that it's a known bug but he didn't have time to solve it because of private business in real life.
Andrey suggests skipping broken source maps. I am fine with this suggestion but the real problem is that nobody of us are familiar with source code and how it actually works. I will try to look deeper into the code but can't promise anything.
Just not that I suggest skipping broken mapping (pos 1 > pos 2), not entire source map π
Thank you for the update @7rulnik
π€ Should we then maybe consider moving away from source-map-js
for PostCSS?
If I understand it correctly source-map-js
is a rescue project for source-map
because it radically changed direction and became a rust project.
Finding a different package for source maps might be a better long term solution?
@romainmenke in my opinion β yes There are different implementations https://github.com/tc39/source-map/issues/47 But let's keep this issue related only to source-map-js
@romainmenke can you find a good alternative with sync API?
SourceMapConsumer
is part of PostCSS public API. I canβt change the implementation.
https://github.com/7rulnik/source-map-js/releases/tag/v1.1.0 Huge thanks @ai! Closing this for now.
Thank you @ai, @7rulnik π
Hi!
I am a contributor to
postcss
and an issue was reported there that I think can only be solved here: https://github.com/postcss/postcss/issues/1914Reproduction :
As far as I can tell it is allowed to have fewer fields in mapping segments. https://sourcemaps.info/spec.html#h.lmz475t4mvbx
I created the sourcemap by cloning https://github.com/swagger-api/swagger-ui and removing most of the CSS content to create a small output that was easier to read.
Any sourcemap produced by the setup in that project gives an error in
source-map-js
.It is perfectly possible that the issue is with how the sourcemap is generated and not with how it is read.