Open osdevisnot opened 6 years ago
seems we need to pass the path of extracted file as to
, mind sending a pull request to fix that? 😄
I tried looking into this, but I'm little confused for extract: true
option. I guess I can try something like this:
if (postcssLoaderOptions.extract) {
if (typeof postcssLoaderOptions.extract === 'string') {
postcssLoaderOptions.postcss.to = postcssLoaderOptions.extract
} else {
postcssLoaderOptions.postcss.to = path.join('dist', 'bundle.css')
}
}
but how do I determine default value for to
when extract
is set to true
as opposed to filename.
hmm I guess to fix this we have to set extract
to a string since we don't know where the css should be extracted to during transformation.
when extract: true
we may simply use this.id
as the fallback for to
😅 also call this.warn(msg)
to remind user of the downside of using true
for extract
ah seems we need to correctly set to
even if it's not extracted..
btw I think you may use https://github.com/borodean/postcss-assets instead
I can probably try looking up into postcss-assets. Meanwhile, would you be interested in a PR to fix .to
behavior only for extract = "path"
?
While investigating an issue with path transforms, it seems I might have hit a bug in this plugin. I created a example to reproduce the issue with minimal settings here: https://github.com/osdevisnot/rollup-plugin-postcss-demo
In a nutshell, it seems we are passing incorrect to option to postcss plugins which causes issues with path transformation for
postcss-copy-assets
Let me know if I should add more information to this bug report, but the README here summarizes issue correctly: