Skip to content

Commit

Permalink
fix: ensure extend optimizeDeps work
Browse files Browse the repository at this point in the history
  • Loading branch information
qmhc committed Oct 30, 2023
1 parent 6b55245 commit d54c3cc
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 131 deletions.
31 changes: 19 additions & 12 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@
@user-action="handleUserAction"
>
<template #main>
<div style="width: 100%; height: 1200px; padding: 20px;">
<VButton type="success" :icon="IUser" @click="handleClick">
Button
</VButton>
<v-auto-complete></v-auto-complete>
<VIcon>
<ISackDollar></ISackDollar>
</VIcon>
<div
v-loading="true"
style="width: 200px; height: 100px; background-color: var(--vxp-bg-color-reverse);"
></div>
<div style="width: 100%; height: 1200px; padding: 20px">
<VSpace vertical>
<div>
<VButton type="primary" :icon="IUser">
Button
</VButton>
<VButton type="success" :icon="IUser" @click="handleClick">
Button
</VButton>
</div>
<v-auto-complete style="max-width: 400px"></v-auto-complete>
<VIcon>
<ISackDollar></ISackDollar>
</VIcon>
<div
v-loading="true"
style="width: 200px; height: 100px; background-color: var(--vxp-bg-color-reverse)"
></div>
</VSpace>
</div>
</template>
</VLayout>
Expand Down
25 changes: 19 additions & 6 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
// import { fileURLToPath } from 'node:url'
import vexipUI from '../src/module'

const vxpStylePresetRE = /vexip-ui\/style(?:\/dark)?\/preset/

export default defineNuxtConfig({
// alias: {
// 'vexip-ui': fileURLToPath(new URL('../../..', import.meta.url)),
// '@vexip-ui/icons': fileURLToPath(new URL('../../icons/dist/index', import.meta.url))
// },
modules: [vexipUI],
vexipUI: {}
vexipUI: {
importStyle: 'sass',
importDarkTheme: true
},
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: (code: string, path: string) => {
return vxpStylePresetRE.test(path)
? code.replace('@use \'./design/variables.scss\' as *;', '@use \'@/style/variables.scss\' as *;')
: code
}
}
}
}
}
})
5 changes: 4 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"private": true,
"name": "vexip-nuxt-playground"
"name": "vexip-nuxt-playground",
"devDependencies": {
"sass": "^1.69.3"
}
}
7 changes: 7 additions & 0 deletions playground/style/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@forward 'vexip-ui/style/design' with (
$color-map: (
primary: (
base: #845ef7
)
)
);
244 changes: 133 additions & 111 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- playground
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default defineNuxtModule<ModuleOptions>({
config.optimizeDeps = config.optimizeDeps || {}
config.optimizeDeps.include = config.optimizeDeps.include || []
config.optimizeDeps.include.push('vexip-ui', '@vexip-ui/icons')
}, { build: false })
})

nuxt.hook('vite:extendConfig', (config, { isClient }) => {
config.plugins = config.plugins || []
Expand Down

0 comments on commit d54c3cc

Please sign in to comment.