Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/open-hotels-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@devup-ui/vite-plugin": patch
---

Fix extract issue
9 changes: 9 additions & 0 deletions packages/vite-plugin/src/__tests__/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ describe('devupUIPlugin', () => {
.config()
.build.rollupOptions.output.manualChunks('devup-ui.css?v=1', 'code'),
).toEqual('devup-ui.css')

const plugin1 = DevupUI({
package: libPackage,
cssFile,
devupPath,
interfacePath,
extractCss: false,
})
expect((plugin1 as any).config().build).toBeUndefined()
})
it('should resolveId', () => {
expect((plugin as any).resolveId('code', 'code')).toBeUndefined()
Expand Down
11 changes: 7 additions & 4 deletions packages/vite-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
registerTheme,
setDebug,
} from '@devup-ui/wasm'
import { normalizePath, type PluginOption } from 'vite'
import { normalizePath, type PluginOption, type UserConfig } from 'vite'

export interface DevupUIPluginOptions {
package: string
Expand Down Expand Up @@ -69,13 +69,15 @@ export function DevupUI({
return {
name: 'devup-ui',
config() {
return {
const ret: Omit<UserConfig, 'plugins'> = {
server: {
watch: {
ignored: [`!${devupPath}`],
},
},
build: {
}
if (extractCss) {
ret['build'] = {
rollupOptions: {
output: {
manualChunks(id) {
Expand All @@ -86,8 +88,9 @@ export function DevupUI({
},
},
},
},
}
}
return ret
},
apply() {
return true
Expand Down