build(vconsole): vconsole => vite-plugin-vconsole close #9
This commit is contained in:
parent
7d9abaf70d
commit
ca28d0b254
|
|
@ -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
src/main.ts
10
src/main.ts
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -19,11 +20,7 @@ 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({
|
||||
|
|
@ -31,6 +28,15 @@ export default ({ mode }: ConfigEnv): UserConfig => {
|
|||
resolvers: [VantResolver()],
|
||||
types: [],
|
||||
}),
|
||||
viteVConsole({
|
||||
entry: [path.resolve('src/main.ts')],
|
||||
localEnabled: command === 'serve',
|
||||
enabled: false,
|
||||
config: {
|
||||
maxLogNumber: 1000,
|
||||
theme: 'light'
|
||||
}
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
11
yarn.lock
11
yarn.lock
|
|
@ -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"
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue