rollup-plugin-styles
rollup-plugin-styles copied to clipboard
Duplicate emitted files when multiple `url()` references to same file
Some CSS like this:
.thing {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background-image: url("./img/wire.png"), url("./img/wire.png");
background-repeat: no-repeat, no-repeat;
background-position: 33% 0, 66% 0;
background-size: 11px 56px, 11px 56px;
}
…produces the following Rollup warning:
(!) The emitted file "wire-9d64d534.png" overwrites a previously emitted file of the same name.
While nothing breaks, processing url() assets only once each seems like a good possible improvement.
I was able to fix the warning by moving a seemingly-unrelated chunk of code, so if you find that you cannot reproduce this bug, then that means I mistakenly assumed it was a bug in rollup-plugin-styles. Sorry about that!
Whoop, spoke too soon; it appears to be somewhat non-deterministic.
I forgot to show my plugin config, sorry about that:
stylesPlugin({
mode: 'extract',
sourceMap: true,
minimize: __PROD__,
url: {
publicPath,
hash: '[hash].[ext]'
}
})