This looks like an issue with the interaction of resolve and postcss. Certain imported css files are included without an issue, but others disappear without a trace. Note that this happens only when using resolve (see details), so I have submitted it here. I hope that this is the right place for it!
The issue appears when trying to import vuetify's css with resolve and postcss.
5.2.01.20.2archlinux12.9.1When trying to import vuetify css with resolve, it simply is not included, as if the import didn't exist
// test.js
import 'vuetify/dist/vuetify.css';
npm i rollup rollup-plugin-node-resolve rollup-plugin-postcss vuetify codemirror
// rollup.config.js
import resolve from "rollup-plugin-node-resolve"
import postcss from "rollup-plugin-postcss"
export default {
input: "test.js",
output: {
file: "test.mjs",
format: "es"
},
plugins: [resolve(),postcss()]
}
Running rollup with rollup -c
Importing certain files with resolve works fine
// test.js
import 'codemirror/lib/codemirror.css';
Importing the problematic file directly (without resolve) also works without issue
cp node_modules/vuetify/dist/vuetify.css ./vuetify.css
```js
// test.js
import "./vuetify.css"
Trying to import a file that does not exist gives the expected error
```js
import "doesnotexist.css"; // as expected, fails with "Unresolved dependencies" error
// test.js
import 'vuetify/dist/vuetify.css';
An empty bundle is generated, without any error.
Can you install [email protected] and see if it works?
5.0.3 worked! I'll use that for now, thanks!
It's because of d49e257. It has a problem with sideEffects and filter. I will open an issue soon.
Hey folks (this is a canned reply, but we mean it!). Thanks to everyone who participated in this issue. We're getting ready to move this plugin to a new home at https://github.com/rollup/plugins, and we have to do some spring cleaning of the issues to make that happen. We're going to close this one, but it doesn't mean that it's not still valid. We've got some time yet before the move while we resolve pending Pull Requests, so if this issue is still relevant, please @ me and I'll make sure it gets transferred to the new repo. :beer:
@shellscape The bug remains when setting up the project with lerna.
@hiendv @dkumor I've finally got the bandwidth to take a look at this. Can either of you break this down into a minimal reproduction using a repo or the repl? If possible, without using the postcss plugin.
While I haven't looked into why the issue is happening, so I'm not sure how to reproduce without postcss, I have recreated the minimal reproduction above (with postcss): https://repl.it/repls/EcstaticFaithfulPolygon
As mentioned above, the issue is not present in 5.0.3.
@dkumor's problem is caused by the vuetify sideEffects setting.
node_modules/vuetify/**/*.cssnode_modules/vuetify/*.cssnode_modules/vuetify/dist/vuetify.cssYou can try modifying node_modules/vuetify/package.json sideEffects to */*.css and see if it works.
Mine is another problem with lerna symlink and stuff. I'm trying to reproduce asap.
@hiendv yes, looks like that was the issue! If I understand correctly, this means there are two bugs here:
sideEffects setting for css files, which needs to be fixed on their end.Is my understanding correct?
@dkumor
sideEffects vary between rollup and webpack. It works fine when bundling with webpack I believe.oops, sorry - not plugin-replace, but node-resolve (edited comment to fix)! Thanks for your help in figuring out this problem @hiendv!
In general, I guess my issue can be boiled down to the fact that plugin-node-resolve is unable to import the explicitly referenced css if it is outside of sideEffects - and it does not notify of the error. The current behavior of silently failing caused me quite a bit of confusion!
@dkumor I guess you should keep this issue open because of the difference between rollup and webpack on resolving "*.css" :D
Hey folks, this one has gone quite stale. We're going to close for housekeeping but we'd happily review any PRs that pop up to resolve this issue.
I had a similar issue with @rollup/plugin-node-resolve where my nested CSS files were not being included in the output bundle.
Fixed by changing my package.json's sideEffects field to "sideEffects": [
"**/*.css",
"**/*.scss"
],
Most helpful comment
oops, sorry - not plugin-replace, but node-resolve (edited comment to fix)! Thanks for your help in figuring out this problem @hiendv!
In general, I guess my issue can be boiled down to the fact that plugin-node-resolve is unable to import the explicitly referenced css if it is outside of sideEffects - and it does not notify of the error. The current behavior of silently failing caused me quite a bit of confusion!