Skip to content

Commit

Permalink
test: add case for #12072
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Nov 10, 2023
1 parent 61c19bf commit ed2be42
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions playground/css/__tests__/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,10 @@ test('async css order with css modules', async () => {
test('@import scss', async () => {
expect(await getColor('.at-import-scss')).toBe('red')
})

test.runIf(isBuild)('manual chunk path', async () => {
// assert that the manual-chunk css is output in the directory specified in manualChunk (#12072)
expect(
findAssetFile(/dir\/dir2\/manual-chunk-[-\w]{8}\.css$/),
).not.toBeUndefined()
})
1 change: 1 addition & 0 deletions playground/css/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './sugarss.sss'
import './sass.scss'
import './less.less'
import './stylus.styl'
import './manual-chunk.css'

import rawCss from './raw-imported.css?raw'
text('.raw-imported-css', rawCss)
Expand Down
3 changes: 3 additions & 0 deletions playground/css/manual-chunk.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.manual-chunk {
color: blue;
}
9 changes: 9 additions & 0 deletions playground/css/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ globalThis.location = new URL('http://localhost/')
export default defineConfig({
build: {
cssTarget: 'chrome61',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('manual-chunk.css')) {
return 'dir/dir2/manual-chunk'
}
},
},
},
},
esbuild: {
logOverride: {
Expand Down

0 comments on commit ed2be42

Please sign in to comment.