Skip to content

Commit

Permalink
feat(vite): add cssCodeSplit in build options
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed May 25, 2023
1 parent 7cc67a3 commit bc80ed2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/generated/packages/vite/executors/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"description": "Force the optimizer to ignore the cache and re-bundle",
"type": "boolean"
},
"cssCodeSplit": {
"description": "Enable/disable CSS code splitting. When enabled, CSS imported in async chunks will be inlined into the async chunk itself and inserted when the chunk is loaded.",
"type": "boolean",
"default": true
},
"watch": {
"description": "Enable re-building when files change.",
"oneOf": [{ "type": "boolean" }, { "type": "object" }],
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/executors/build/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface ViteBuildExecutorOptions {
target?: string | string[];
generatePackageJson?: boolean;
includeDevDependenciesInPackageJson?: boolean;
cssCodeSplit?: boolean;
}
5 changes: 5 additions & 0 deletions packages/vite/src/executors/build/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
"description": "Force the optimizer to ignore the cache and re-bundle",
"type": "boolean"
},
"cssCodeSplit": {
"description": "Enable/disable CSS code splitting. When enabled, CSS imported in async chunks will be inlined into the async chunk itself and inserted when the chunk is loaded.",
"type": "boolean",
"default": true
},
"watch": {
"description": "Enable re-building when files change.",
"oneOf": [
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/utils/options-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function getViteBuildOptions(
outDir: relative(projectRoot, options.outputPath),
emptyOutDir: options.emptyOutDir,
reportCompressedSize: true,
cssCodeSplit: true,
cssCodeSplit: options.cssCodeSplit,
target: options.target ?? 'esnext',
commonjsOptions: {
transformMixedEsModules: true,
Expand Down

0 comments on commit bc80ed2

Please sign in to comment.