You need to sign in or sign up before continuing.
vitest.config.js 948 Bytes
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'url'
import { dirname, resolve } from 'path'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

const ignoreCssPlugin = () => ({
  name: 'ignore-css',
  enforce: 'pre',
  resolveId(id) {
    if (id.endsWith('.css')) {
      return id
    }
    return null
  },
  load(id) {
    if (id.endsWith('.css')) {
      return ''
    }
    return null
  }
})

export default defineConfig({
  plugins: [ignoreCssPlugin(), vue()],
  test: {
    environment: 'happy-dom',
    css: true,
    deps: {
      inline: ['@nutui/icons-vue-taro']
    }
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
      '@nutui/icons-vue-taro': resolve(__dirname, 'node_modules/@nutui/icons-vue-taro/dist/es/index.es.js')
    },
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  }
})