unplugin-vconsole-import
v0.0.7
Published
Downloads
4
Maintainers
Readme
unplugin-vconsole-import
Use the function of VConsole in various environments. Use in vite, webpack, rollup, esbuild
Install
pnpm install vconsole
pnpm install unplugin-vconsole-import -D
Usage
- vite
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteVConsole from 'unplugin-vconsole-import/vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
viteVConsole({
entry: resolve(__dirname, './src/main.ts'),
// enabled: false,
}),
],
})
- webpack
// 引入插件
const webpackVConsole = require('unplugin-vconsole-import/webpack');
...
{
...
plugins: [
webpackVConsole({
entry: resolve(__dirname, './src/main.ts'),
// enabled: false,
}),
...
]
...
}
Options
{
entry: string | string[]; // entry file that you want to use vconsole
enabled?: boolean;
config?: { // vconsole's options
defaultPlugins?: string[];
onReady?: () => void;
onClearLog?: () => void;
maxLogNumber?: number;
disableLogScrolling?: boolean;
theme?: 'light' | 'dark';
};
}
License
MIT License © 2022 fightwithtiger