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
Impossible to generate an absolute source map "sources" #1352
Comments
|
Yes, at the moment it is impossible to get them
We should support them, but there is a problem here that some packages still generate not URLs, so we should take attention on this. Possible fixes for
|
Yeap, we can’t generate absolute paths by default, but it will be nice to have option |
@ai How about fixing this for |
It may take a long time when |
What will be the smallest fix for the webpack team? Adding |
@ai Yes, adding What do you think generate absolute sources by default for I would like to add tests to make sure that postcss merges source maps fine when other source map contains |
It will be very helpful
I do not like that after generation, you will not be able to move the files. Files generated at one client will not work on another machine. |
@ai What about d small breaking change for v8 and:
PostCSS already works fine with |
But we use a relative URL in the generated file. What do you think about the extra option to use an absolute path? |
I think it is real unnecessary, the |
Fixed 76ac72e |
We are currently experiencing problems with generating absolute "source" in source maps. And there is no solution. We use
postcss
as a parser for css inwebpack
(css-loader/postcss-loader/other loaders usepostcss
).Why we need absolute source maps?
Each loader should return absolute
sources
(just note -babel-loader
/ts-loader
generate absolute urls in sources by default). This allows us to allow developers to customize source maps, for example:css
like loaders.Looks the same problem - #1348.
For example when you use
sass-loader
/less-loader
andpostcss-loader
, it really makes it almost impossible to merge source maps from other loaders/tools. We have to rely oncwd
, but it is wrong, monorepos suffer from this - webpack-contrib/css-loader#1064.Since the original maps may intersect with the existing source map (not from webpack),
sources
may intersect, for example part of css I generated usespostcss
, other part generated usingcss-loader
/postcss-loader
, to avoiding this we useswebpack://
prefix forsources
in source maps from webpack. But without an absolute path insources
, we cannot do it right, we don't knowsourceRoot
.It is worth saying that perhaps we could fix this without global changes (breaking changes) if postcss output
sourceRoot
in source maps.Recently, we get quite a lot of problems with this and it would be nice not assign it to
8
version and fix it in7
version. Yep, I can send a PR 👍If required, I can provide a reproducible examples, but I think the ideas/problems here are pretty simple.
Ideally if
postcss@8
generated absolutesources
by default if you don't provideto
option.I noticed another strange behavior, I would consider it as a bug:
Generate sources like (no
/
beforesources
and it is expected):But:
Generate sources like (it is not absolute sources and it is unexpected):
Looks we doesn't respect
''
(empty string) and consider it asfalsy
value.And yes,
sources
are urls, but some tools (includingpostcss
) generate\
slashes on windows, but it is invalid, I think this may be a problem when you will merge sources on windows from other tools which always generate/
slashes, but we can add tests for it./cc @ai I would like to hear your opinion on this, we are preparing a big update for CSS pipelines in webpack, and broken source map is blocker for us. It is also worth saying that such problems are experiencing with other bundlers like
rollup
andparcel
.The text was updated successfully, but these errors were encountered: