Closed simonerlandsen closed 7 months ago
Hey! Thanks for reporting this.
We did just add an exception to not parse .css
files: https://github.com/Ephem/rollup-plugin-preserve-directives/pull/20
I'm not super well versed in Rollup actually so I'm not quite sure how this is supposed to work in a scalable fashion though. I'd be happy to add .scss
-files to that list too, but I have a feeling that's not the correct approach long term, there are a bunch of possible files that could be imported after all and going by file extension also feels brittle. Catching the parsing error and ignoring it could be another way I guess..? If it's a "real" parsing error I guess that would bubble up elsewhere, maybe?
I don't have that much time to research this at the moment, so if anyone knows how Rollup plugins usually handle this I would love to hear! I would happily accept a PR to add .scss
to the existing .css
filter too just to unblock that case specifically.
@Ephem Thanks alot for your response, and not least for tackling the core issue that this plugin is addressing, for anyone who needs it.
I am not versed in developing rollup plugins, so I do not know how scss usually is dealt with, but I will see about adding scss to the existing filter in a PR on Monday.
Again, thank you for the response 🙏
I just hit the same issue, but with .pcss
files.
@adbutterfield I am working on a PR that will let us add file types to ignore by passing an array in an option. Will add the PR soon.
@adbutterfield Thanks for reporting that!
@simonerlandsen That sounds like a great pragmatic approach, looking forward to it!
@Ephem I don't want to nag, but do you have any idea of when you will be able to look at the PR (and hopefully publish a new versjon)?
No worries! Busy week but managed to find the time this morning so it's now been released as v0.4.0, thanks again for posting the issue and taking the time to submit a fix! ❤️
Lovely! I've tested 0.4.0 and it's working for me. @adbutterfield this should hopefully solve your issue as well, by you adding an exclude pattern in the options like so:
preserveDirectives({ exclude: ['**/*.pcss'] })
I have react components that imports scss files. When adding this plugin I get this error on build:
versions: