mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 01:53:55 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { defineNuxtModule } from '@nuxt/kit'
|
|
|
|
export default defineNuxtModule(nuxt => ({
|
|
name: 'windicss',
|
|
defaults: {
|
|
root: nuxt.options.rootDir,
|
|
scan: {
|
|
dirs: ['./'],
|
|
exclude: [
|
|
'node_modules',
|
|
'.git',
|
|
'.github',
|
|
'.nuxt/**/*',
|
|
'*.template.html',
|
|
'app.html'
|
|
]
|
|
}
|
|
},
|
|
setup (options, nuxt) {
|
|
nuxt.options.build.transpile.push('windi.css')
|
|
|
|
nuxt.hook('vite:extend', async ({ config }) => {
|
|
const WindiCSS = await import('vite-plugin-windicss').then(r => r.default)
|
|
config.plugins.push(WindiCSS(options))
|
|
config.optimizeDeps = {
|
|
exclude: [
|
|
'windi.css',
|
|
'virtual:windi.css'
|
|
]
|
|
}
|
|
})
|
|
|
|
nuxt.hook('webpack:config', async (configs) => {
|
|
const WindiCSSWebpackPlugin = await import('windicss-webpack-plugin').then(r => r.default)
|
|
const windiPlugin = new WindiCSSWebpackPlugin(options)
|
|
configs.forEach((config) => { config.plugins.push(windiPlugin) })
|
|
})
|
|
}
|
|
}))
|