Skip to content

preserveModules, but keep and entry point with @import #248

@fregante

Description

@fregante

I'm trying to use preserveModules: true primarily for JS code, but this has a confusing output for CSS files.

Input

/* main.js */
import './alpha.css';
import './beta.css';
console.log('hi')
/* alpha.css */
html {color: red;}
/* beta.css */
body {font-weight: bold}

Current output

/* main.js */
console.log('hi')
/* main.css */
html {color: red;}
body {font-weight: bold}
/* alpha.css */
html {color: red;}
/* beta.css */
body {font-weight: bold}

Expected output

One of:

  • only main.css (ignoring preserveModule, which I don't need for CSS)
  • alpha.css, beta.css, and a main.css that looks like @import 'alpha.css';@import 'beta.css'

Final notes

I'm mostly ok with the current behavior as the duplicate CSS is minor and inert, but I'm afraid that this is considered a "bug" and it might be "fixed" in a way that doesn't match my expectations (i.e. main.css is no longer created or it's empty, without imports)

Related

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