|
1 | 1 | import path from 'node:path' |
2 | 2 | import type { Rollup } from 'vite' |
3 | 3 | import { build } from 'vite' |
4 | | -import * as vite from 'vite' |
5 | 4 | import { describe, expect, test } from 'vitest' |
6 | 5 |
|
7 | | -const isRolldownVite = 'rolldownVersion' in vite |
8 | | - |
9 | 6 | describe('vue component library', () => { |
10 | | - // skip this test for now with rolldown-vite due to https://github.com/oxc-project/oxc/issues/10033 |
11 | | - test.skipIf(isRolldownVite)( |
12 | | - 'should output tree shakeable css module code', |
13 | | - async () => { |
14 | | - // Build lib |
15 | | - await build({ |
16 | | - logLevel: 'silent', |
17 | | - configFile: path.resolve(__dirname, '../vite.config.lib.ts'), |
18 | | - }) |
19 | | - // Build app |
20 | | - const { output } = (await build({ |
21 | | - logLevel: 'silent', |
22 | | - configFile: path.resolve(__dirname, '../vite.config.consumer.ts'), |
23 | | - })) as Rollup.RollupOutput |
24 | | - const { code } = output.find( |
25 | | - (e) => e.type === 'chunk' && e.isEntry, |
26 | | - ) as Rollup.OutputChunk |
27 | | - // Unused css module should be treeshaked |
28 | | - expect(code).toContain('styleA') // styleA is used by CompA |
29 | | - expect(code).not.toContain('styleB') // styleB is not used |
30 | | - }, |
31 | | - ) |
| 7 | + test('should output tree shakeable css module code', async () => { |
| 8 | + // Build lib |
| 9 | + await build({ |
| 10 | + logLevel: 'silent', |
| 11 | + configFile: path.resolve(__dirname, '../vite.config.lib.ts'), |
| 12 | + }) |
| 13 | + // Build app |
| 14 | + const { output } = (await build({ |
| 15 | + logLevel: 'silent', |
| 16 | + configFile: path.resolve(__dirname, '../vite.config.consumer.ts'), |
| 17 | + })) as Rollup.RollupOutput |
| 18 | + const { code } = output.find( |
| 19 | + (e) => e.type === 'chunk' && e.isEntry, |
| 20 | + ) as Rollup.OutputChunk |
| 21 | + // Unused css module should be treeshaked |
| 22 | + expect(code).toContain('styleA') // styleA is used by CompA |
| 23 | + expect(code).not.toContain('styleB') // styleB is not used |
| 24 | + }) |
32 | 25 |
|
33 | 26 | test('should inject css when cssCodeSplit = true', async () => { |
34 | 27 | // Build lib |
|
0 commit comments