Skip to content

Commit

Permalink
feature: add inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Aug 2, 2022
1 parent cb66c47 commit db62128
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions build/vite/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import { configPwaPlugin } from './pwa';
import ElementPlus from 'unplugin-element-plus/vite';
// setip使用Options API
import DefineOptions from 'unplugin-vue-define-options/vite';

// 自定义插件 问候语,打包检测用时、大小
import viteBuildOuteInfo from './buildOuteInfo';
// 检查插件状态
import Inspect from 'vite-plugin-inspect';

// eslint
// import { configEsLinterPlugin } from './eslinter'
Expand All @@ -45,15 +47,17 @@ export function createVitePlugins(isBuild = false, _configEnv: ConfigEnv) {

vitePlugins.push(DefineOptions());

vitePlugins.push(viteBuildOuteInfo());

vitePlugins.push(Inspect());

/* 会重复引入与组件数量相等的主题变量 */
vitePlugins.push(
ElementPlus({
useSource: true,
}),
);

vitePlugins.push(viteBuildOuteInfo());

// 使用此插件会导致vite启动变慢 100ms左右
// vitePlugins.push(configEsLinterPlugin(configEnv))

Expand Down
4 changes: 2 additions & 2 deletions build/vite/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export function createViteServer(): ServerOptions {
// 服务器主机名,如果允许外部访问,可设置为"0.0.0.0"
host: true,
// 服务器端口号
port: 3000,
port: 5173,
// 端口已被占用时是否尝试使用下一个可用的端口 true:直接退出,而不是尝试下一个可用端口 false:尝试下一个可用端口
strictPort: false,
// boolean | string 启动项目时自动在浏览器打开应用程序;如果为string,比如"/index.html",会打开http://localhost:3000/index.html
// boolean | string 启动项目时自动在浏览器打开应用程序;如果为string,比如"/index.html",会打开http://localhost:5173/index.html
// open: true,
// boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源,传递一个 选项对象 来调整行为或设为 false 表示禁用。
// cors: true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"unplugin-vue-define-options": "^0.6.2",
"vite": "^3.0.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-inspect": "^0.6.0",
"vite-plugin-linter": "^1.2.0",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-pwa": "^0.12.3",
Expand Down

0 comments on commit db62128

Please sign in to comment.