Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Dec 1, 2024
1 parent ba322c0 commit bf92d4a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
// TEST: funky build output directory
build: {
outDir: `${__dirname}/../../test/playground/dist/nested`,
assetsDir: '/nested-dir/assets'
assetsDir: '/nested-dir/assets',
cssCodeSplit: false
},
plugins: [
react(),
Expand Down
2 changes: 2 additions & 0 deletions vike/node/plugin/plugins/buildConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import fs from 'fs/promises'
import path from 'path'
import {
fixServerAssets,
fixServerAssets_assertCssCodeSplit,
fixServerAssets_assertCssTarget,
fixServerAssets_assertCssTarget_populate,
fixServerAssets_isEnabled
Expand Down Expand Up @@ -73,6 +74,7 @@ function buildConfig(): Plugin[] {
// Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
config.build.cssMinify = 'esbuild'
fixServerAssets_assertCssTarget_populate(config)
fixServerAssets_assertCssCodeSplit(config)
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions vike/node/plugin/plugins/buildConfig/fixServerAssets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { fixServerAssets }
export { fixServerAssets_isEnabled }
export { fixServerAssets_assertCssCodeSplit }
export { fixServerAssets_assertCssTarget }
export { fixServerAssets_assertCssTarget_populate }

Expand Down Expand Up @@ -191,6 +192,17 @@ function getHash(src: string) {
return hash
}

// https://github.com/vikejs/vike/issues/1993
function fixServerAssets_assertCssCodeSplit(config: ResolvedConfig) {
assertWarning(
config.build.cssCodeSplit,
`${pc.cyan('build.cssCodeSplit')} shouldn't be set to ${pc.cyan(
'false'
)} (https://github.com/vikejs/vike/issues/1993)`,
{ onlyOnce: true }
)
}

// https://github.com/vikejs/vike/issues/1815
type Target = undefined | false | string | string[]
type TargetConfig = { global: Exclude<Target, undefined>; css: Target; isServerSide: boolean }
Expand Down

0 comments on commit bf92d4a

Please sign in to comment.