mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
fix(legacy): emit css assets when no cssCodeSplit and modernChuns are off
This commit is contained in:
parent
fd9de0473e
commit
db125a7067
@ -467,7 +467,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
|
||||
// we'll delete the assets from the legacy bundle to avoid emitting duplicate assets.
|
||||
// But that's still a waste of computing resource.
|
||||
// So we add this flag to avoid emitting the asset in the first place whenever possible.
|
||||
opts.__vite_skip_asset_emit__ = true
|
||||
opts.__vite_skip_asset_emit__ = genModern
|
||||
|
||||
// avoid emitting assets for legacy bundle
|
||||
const needPolyfills =
|
||||
|
@ -10,6 +10,7 @@
|
||||
"build:multiple-output": "vite --config ./vite.config-multiple-output.js build",
|
||||
"build:no-polyfills": "vite --config ./vite.config-no-polyfills.js build",
|
||||
"build:no-polyfills-no-systemjs": "vite --config ./vite.config-no-polyfills-no-systemjs.js build",
|
||||
"build:css-code-split": "vite --config ./vite.config-css-code-split.js build",
|
||||
"build:watch": "vite --config ./vite.config-watch.js build --debug legacy",
|
||||
"debug": "node --inspect-brk ../../packages/vite/bin/vite",
|
||||
"preview": "vite preview"
|
||||
|
21
playground/legacy/vite.config-css-code-split.js
Normal file
21
playground/legacy/vite.config-css-code-split.js
Normal file
@ -0,0 +1,21 @@
|
||||
import path from 'node:path'
|
||||
import legacy from '@vitejs/plugin-legacy'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
legacy({
|
||||
renderModernChunks: false,
|
||||
}),
|
||||
],
|
||||
|
||||
build: {
|
||||
outDir: 'dist/css-code-split',
|
||||
cssCodeSplit: false,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
index: path.resolve(__dirname, 'index.html'),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue
Block a user