Skip to content

入门

Unplugin Torbo Console 是一个通用型插件,旨在增强前端开发人员在使用 console 时的开发者体验(DX)。它拥有许多实用的功能与灵活的可配置项,得益于Unplugin,它几乎适用于所有现代前端框架。你可以从下面的视频中看到它的部分功能:

使用

安装

bash
pnpm add -D unplugin-turbo-console
bash
yarn add unplugin-turbo-console -D
bash
npm i unplugin-turbo-console --save-dev
bash
bun add unplugin-turbo-console -d

集成

打包工具

ts
// vite.config.ts
import { 
defineConfig
} from 'vite'
import
TurboConsole
from 'unplugin-turbo-console/vite'
export default
defineConfig
({
plugins
: [
TurboConsole
({
/* options here */ }) ], })
js
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-turbo-console/webpack').default({ /* options */ }),
  ],
}
js
// vue.config.js
const { defineConfig } = require('@vue/cli-service')

module.exports = defineConfig({
  transpileDependencies: true,
  parallel: false, // important!
  configureWebpack: {
    plugins: [
      require('unplugin-turbo-console/webpack').default({
        /* options here */
      })
    ]
  }
})
js
// rspack.config.js
const rspack = require('@rspack/core')
const { VueLoaderPlugin } = require('vue-loader')
/** @type {import('@rspack/cli').Configuration} */

const config = {
  plugins: [
    new VueLoaderPlugin(),
    new rspack.HtmlRspackPlugin({
      template: './index.html'
    }),
    require('unplugin-turbo-console/rspack').default({
        /* options here */
    }),
  ],

}
module.exports = config
ts
// farm.config.ts
import { 
defineConfig
} from '@farmfe/core'
import
vue
from '@vitejs/plugin-vue'
import
TurboConsole
from 'unplugin-turbo-console/farm'
export default
defineConfig
({
vitePlugins
: [
vue
(),
],
plugins
: [
TurboConsole
({
/* options here */ }) ] })

元框架(Meta-Framework)

ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'unplugin-turbo-console/nuxt'
  ],
  turboConsole: {
    /* options here */
  }
})
ts
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
import TurboConsole from 'unplugin-turbo-console/vite'

export default defineConfig({
  plugins: [
    TurboConsole(), // Please add this plugin before sveltekit
    sveltekit()
  ]
})
js
// astro.config.mjs
import { defineConfig } from 'astro/config'
import TurboConsole from 'unplugin-turbo-console/astro'

// https://astro.build/config
export default defineConfig({
  integrations: [
    TurboConsole()
  ]
})
js
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack(config) {
    config.plugins.push(
      require('unplugin-turbo-console/webpack').default()
    )

    return config
  }
}

module.exports = nextConfig
ts
import { 
defineConfig
} from '@solidjs/start/config'
import
TurboConsole
from 'unplugin-turbo-console/vite'
export default
defineConfig
({
vite
: {
plugins
: [
TurboConsole
()
] }, })

用 ❤️ 发电