Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(nuxt): don't patch cssnano config for nuxt2 (#2010)
  • Loading branch information
sibbng committed Dec 18, 2022
1 parent 4c1fab0 commit 996b915
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/nuxt/src/index.ts
@@ -1,6 +1,6 @@
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { addComponentsDir, addPluginTemplate, defineNuxtModule, extendWebpackConfig, isNuxt2 } from '@nuxt/kit'
import { addComponentsDir, addPluginTemplate, defineNuxtModule, extendWebpackConfig, isNuxt2, isNuxt3 } from '@nuxt/kit'
import WebpackPlugin from '@unocss/webpack'
import VitePlugin from '@unocss/vite'
import type { NuxtPlugin } from '@nuxt/schema'
Expand Down Expand Up @@ -61,7 +61,8 @@ export default defineNuxtModule<UnocssNuxtOptions>({
const { config: unoConfig } = await loadConfig<UserConfig>(process.cwd(), {}, [], options)

if (
nuxt.options.postcss.plugins.cssnano
isNuxt3()
&& nuxt.options.postcss.plugins.cssnano
&& unoConfig.transformers?.some(t => t.name === 'css-directive' && t.enforce !== 'pre')
) {
const preset = nuxt.options.postcss.plugins.cssnano.preset
Expand Down

0 comments on commit 996b915

Please sign in to comment.