61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import Uni from '@dcloudio/vite-plugin-uni'
|
|
import UniHelperComponents from '@uni-helper/vite-plugin-uni-components'
|
|
import UniHelperLayouts from '@uni-helper/vite-plugin-uni-layouts'
|
|
import UniHelperManifest from '@uni-helper/vite-plugin-uni-manifest'
|
|
import UniHelperPages from '@uni-helper/vite-plugin-uni-pages'
|
|
import uniTailwind from '@uni-helper/vite-plugin-uni-tailwind'
|
|
import postcssPresetEnv from 'postcss-preset-env'
|
|
import tailwindcss from 'tailwindcss'
|
|
import nested from 'tailwindcss/nesting'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import { defineConfig } from 'vite'
|
|
import tailwindcssConfig from './tailwind.config' // 注意匹配实际文件
|
|
|
|
// 注意匹配实际文件
|
|
|
|
// https://vitejs.dev/config/
|
|
export default async () => {
|
|
return defineConfig({
|
|
css: {
|
|
postcss: {
|
|
plugins: [
|
|
nested(),
|
|
tailwindcss({
|
|
config: tailwindcssConfig,
|
|
}),
|
|
postcssPresetEnv({
|
|
stage: 3,
|
|
features: { 'nesting-rules': false },
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
plugins: [
|
|
// https://github.com/uni-helper/vite-plugin-uni-manifest
|
|
UniHelperManifest(),
|
|
// https://github.com/uni-helper/vite-plugin-uni-pages
|
|
UniHelperPages({
|
|
dts: 'src/uni-pages.d.ts',
|
|
}),
|
|
// https://github.com/uni-helper/vite-plugin-uni-layouts
|
|
UniHelperLayouts(),
|
|
// https://github.com/uni-helper/vite-plugin-uni-components
|
|
UniHelperComponents({
|
|
dts: 'src/components.d.ts',
|
|
directoryAsNamespace: true,
|
|
}),
|
|
Uni(),
|
|
// https://github.com/antfu/unplugin-auto-import
|
|
AutoImport({
|
|
imports: ['vue', '@vueuse/core', 'uni-app'],
|
|
dts: 'src/auto-imports.d.ts',
|
|
dirs: ['src/composables', 'src/stores', 'src/utils'],
|
|
vueTemplate: true,
|
|
}),
|
|
uniTailwind({
|
|
/* options */
|
|
}),
|
|
],
|
|
})
|
|
}
|