forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(legacy): fix conflict with the modern build on css emitting
Fixes vitejs#3296 Supersedes vitejs#3317 The asset emitting conflict may also exist for other types of assets, but let's fix the CSS one first. The conflict here is due to the `hasEmitted` flag that was originally intended to avoid duplicated CSS for multiple output formats vitejs@6bce108#diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263 When the legacy plugin is used, the flag was set to `true` for the emitted CSS of the legacy bundle. But the legacy plugin would remove all its emitted assets later to avoid duplication. So this logic results in no CSS to be actually emitted. In this PR, I used a `__vite_skip_asset_emit__` flag to prevent the CSS `generateBundle` from executing for the legacy build. If other asset emitting plugins encounter similar issues, this flag can be reused.
- Loading branch information
1 parent
6e98ff2
commit 486b011
Showing
6 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import './style.css' | ||
|
||
async function run() { | ||
const { fn } = await import('./async.js') | ||
fn() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#app { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ module.exports = { | |
], | ||
|
||
build: { | ||
cssCodeSplit: false, | ||
manifest: true, | ||
rollupOptions: { | ||
output: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters