Skip to content

CSS Compiler Option Can Never Be Set to trueΒ #158

@bdoms

Description

@bdoms

πŸ› 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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions