Skip to content

[BUG] --watch Lib Mode style.css not regenerated #3566

@JonathanSchndr

Description

@JonathanSchndr

Describe the bug

If a JS file is specified as the target in Lib Mode, CSS / SCSS can also be imported in the JS file. This CSS file is taken during the first creation and generates a style.css. But if you add a --watch parameter, new files are generated, even if there are changes in the CSS files, but no new CSS file.

Reproduction

export default {
  mode: 'development',
  build: {
    emptyOutDir: false, // workaround to prevent a missing style.css after the regeneration with --watch
    lib: {
      entry: './src/lib.js',
      name: 'Lib'
    },
  }
}

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

npx: Installierte 1 in 1.072s

  System:
    OS: macOS 11.2.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 2.79 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - /usr/local/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.14.12 - /usr/local/bin/npm
  Browsers:
    Chrome: 90.0.4430.212
    Edge: 89.0.774.45
    Firefox: 86.0.1
    Safari: 14.0.3
  npmPackages:
    vite: ^2.3.4 => 2.3.4 

Used package manager: npm

Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions