Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Compiler Option Can Never Be Set to true #158

Open
bdoms opened this issue Jan 12, 2021 · 1 comment
Open

CSS Compiler Option Can Never Be Set to true #158

bdoms opened this issue Jan 12, 2021 · 1 comment

Comments

@bdoms
Copy link

bdoms commented Jan 12, 2021

馃悰 Bug Report

馃帥 Configuration (.svelterc, package.json, cli command)

I have different config options for active development vs bundling for production in a svelte.config.js file that looks like this:

var prod = {
    compilerOptions: {css: false}
};

var dev = {
    compilerOptions: {css: true}
};

module.exports = process.env.NODE_ENV === 'production' ? prod : dev;

Everything was working fine until I upgraded parcel-plugin-svelte to version 4.0.8. Now, the the css option never gets set to true anywhere. This means that my ability to run a hot reload server over a websocket with something like parcel app.js works for JavaScript, but the CSS is totally broken.

馃捇 Code Sample

The cause appears to be this commit: e14cf22

Because css is hardcoded to false there and a few lines below that the parcel config OVERRIDES any custom config, it means my config is effectively ignored and there is no way for someone using this plugin to set "css": true: https://github.com/DeMoorJasper/parcel-plugin-svelte/blob/master/packages/parcel-plugin-svelte/lib/svelte-asset.js#L27

I'm not sure what the best solution is given that others were having a problem before (but also why didn't they just set "css": false in their own config, rather than opening a pull request to force it that one way for everyone all the time here?), but hardcoding a config option seems like a bad idea to me in general. In this case it has broken parcel development for me and my team.

I believe the only reason you haven't been swamped with bug reports yet is that the published version is still 4.0.6, which does not contain this bug. I strongly suggest reversing the responsible commit. As soon as 4.0.8 gets published it's going to cause a lot more problems than it solves. And then anyone with similar issues to #138 can always set their own config option themselves, which was working perfectly fine before this anyway.

馃實 Your Environment

"parcel-plugin-svelte": "4.0.8",
"svelte": "3.31.2"

@bdoms
Copy link
Author

bdoms commented Jan 14, 2021

I did some more research, and it's worth noting that the other project that got the same report and pull request - https://github.com/orlov-vo/parcel-transformer-svelte - did not end up merging the commit that hard codes css: false. I'd say that's further evidence it's not a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant