Open
Description
Describe the bug
Dependency pre-bundling does not bundle CSS (or other css langs; in this case, SASS) imports within dependencies.
The result of this is that in serve mode when using component frameworks like Vuetify with per-component imports, each individual CSS file for each individual component is loaded with an independent HTTP request, even though all the scripts for these components are bundled into a single file.
This results in 100+ extra HTTP requests in serve mode.
Reproduction
https://github.com/ascott18/repro-vite-css-prebundling
System Info
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 12.01 GB / 31.94 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.1.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 100.0.4896.75
Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.36)
Internet Explorer: 11.0.19041.1566
npmPackages:
vite: 2.9.3 => 2.9.3
Used Package Manager
npm
Logs
(including image because I can't capture Chrome network tools output in a reasonable text format)
Validations
- Follow our Code of Conduct
- 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.
- 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/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.