Skip to content

Commit

Permalink
build(vconsole): vconsole => vite-plugin-vconsole close #9
Browse files Browse the repository at this point in the history
  • Loading branch information
CharleeWa committed Jun 22, 2022
1 parent 7d9abaf commit ca28d0b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"umi-mock-middleware2": "^1.0.2",
"unplugin-vue-components": "^0.19.6",
"vite": "^2.9.9",
"vite-plugin-vconsole": "^1.2.2",
"vue-tsc": "^0.34.7"
}
}
10 changes: 0 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ import './app.less'
// Vant 桌面端适配
import '@vant/touch-emulator'

// debugger board
import VConsole from 'vconsole'
new VConsole({ theme: 'light' })

// 结束调试后,可移除掉
// vConsole.destroy()

// vite-plugin-vconsole 社区版
// https://github.com/vadxq/vite-plugin-vconsole

const app = createApp(App)

app
Expand Down
18 changes: 12 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
import type { ConfigEnv, UserConfig } from 'vite'
import { visualizer } from 'rollup-plugin-visualizer'
import Components from 'unplugin-vue-components/vite'
import { viteVConsole } from 'vite-plugin-vconsole'
import { VantResolver } from 'unplugin-vue-components/resolvers'
import createMockServer from './build/mockServer'
import path from 'path'

// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv): UserConfig => {
export default ({ command, mode }: ConfigEnv): UserConfig => {
const root = process.cwd()
const env = loadEnv(mode, root)
return {
Expand All @@ -19,18 +20,23 @@ export default ({ mode }: ConfigEnv): UserConfig => {
'process.env.VUE_APP_PUBLIC_PATH': JSON.stringify(env.VITE_APP_PUBLIC_PATH),
},
plugins: [
vue({
// Reactivity transform is an experimental feature.
// https://github.com/vuejs/rfcs/discussions/369.
// reactivityTransform: true
}),
vue(),
vueJsx(),
visualizer(),
Components({
dts: true,
resolvers: [VantResolver()],
types: [],
}),
viteVConsole({
entry: [path.resolve('src/main.ts')],
localEnabled: command === 'serve',
enabled: false,
config: {
maxLogNumber: 1000,
theme: 'light'
}
})
],
resolve: {
alias: {
Expand Down
11 changes: 8 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1282,9 +1282,9 @@ copy-text-to-clipboard@^3.0.1:
integrity sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==

core-js@^3.11.0:
version "3.22.8"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.22.8.tgz#23f860b1fe60797cc4f704d76c93fea8a2f60631"
integrity sha512-UoGQ/cfzGYIuiq6Z7vWL1HfkE9U9IZ4Ub+0XSiJTCzvbZzgPA69oDF2f+lgJ6dFFLEdjW5O6svvoKzXX23xFkA==
version "3.23.2"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.23.2.tgz#e07a60ca8b14dd129cabdc3d2551baf5a01c76f0"
integrity sha512-ELJOWxNrJfOH/WK4VJ3Qd+fOqZuOuDNDJz0xG6Bt4mGg2eO/UT9CljCrbqDGovjLKUrGajEEBcoTOc0w+yBYeQ==

cross-env@^7.0.3:
version "7.0.3"
Expand Down Expand Up @@ -3968,6 +3968,11 @@ vconsole@^3.14.6:
core-js "^3.11.0"
mutation-observer "^1.0.3"

vite-plugin-vconsole@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/vite-plugin-vconsole/-/vite-plugin-vconsole-1.2.2.tgz#58d96835bf75aa034094febc57798f48fa1b9709"
integrity sha512-eB0uyQzEQAijpxxcgnE9h/k0y6Lr5wiYeq+OW/4hPT7sNwd4KVqMKQXArTn5S6zy8Uo7ae7ulAU3atczekAGAw==

vite@^2.9.9:
version "2.9.12"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.12.tgz#b1d636b0a8ac636afe9d83e3792d4895509a941b"
Expand Down

0 comments on commit ca28d0b

Please sign in to comment.