From 2bd4d533e40810805bfa06710ad9bce1b2fe3d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Tue, 26 Oct 2021 17:09:14 +0800 Subject: [PATCH] fix(dev): fix play auto import (#4031) --- play/vite.config.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/play/vite.config.ts b/play/vite.config.ts index 387714310b..c95a5c0e22 100644 --- a/play/vite.config.ts +++ b/play/vite.config.ts @@ -1,17 +1,32 @@ +import path from 'path' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import './vite.init' +import { epRoot, pkgRoot } from '../build/utils/paths' export default defineConfig({ + resolve: { + alias: [ + { + find: /^element-plus$/, + replacement: path.resolve(epRoot, 'index.ts'), + }, + { + find: /^element-plus\/(es|lib)\/(.*)$/, + replacement: `${pkgRoot}/$2`, + }, + ], + }, server: { host: true, }, plugins: [ vue(), Components({ - resolvers: ElementPlusResolver(), + include: `${__dirname}/**`, + resolvers: ElementPlusResolver({ importStyle: 'sass' }), }), ], })