一键启动钉钉内调试。支持 vite
、vue-cli
、rebuild
。
- 在钉钉内打开调试链接
- 可选注入 vConsole 用于调试 (仅支持 vite )
- 可选注入 chii 用于调试
- 可选打开 vue-devtools 用于调试
- 支持调试
HttpOnly
cookies
npm i unplugin-dingtalk --save-dev
interface Options {
enable?: boolean
targetUrl?: string
corpId?: string
debug?: boolean
/**
* only support vite
*
* @link https://github.com/vadxq/vite-plugin-vconsole#vitevconsole-options
*/
vconsole?: viteVConsoleOptions
/** 需要调试的 cookies, 避免无法调试 HttpOnly 的 cookie */
debugCookies?: string[]
/** 默认值 `true` */
chii?: boolean
vueDevtools?: {
enable?: boolean
host?: string
port?: number
}
}
Vite
// vite.config.ts
import UnpluginDingtalk from 'unplugin-dingtalk/vite';
export default defineConfig({
plugins: [
UnpluginDingtalk({
enable: true,
}),
],
});
Vue CLI 5
// vue.config.js
const [setupMiddlewares, unpluginDingtalk] = require('unplugin-dingtalk/webpack').default({
enable: true,
});
/**
* @type {import('@vue/cli-service').ProjectOptions}
*/
module.exports = {
devServer: {
setupMiddlewares,
},
configureWebpack: {
plugins: [
unpluginDingtalk,
],
},
};
Rsbuild
// rsbuild.config.js
import { defineConfig } from '@rsbuild/core';
import createUnpluginDingtalk from 'unplugin-dingtalk/rspack';
const [setupMiddlewares, unpluginDingtalk] = createUnpluginDingtalk({
enable: true,
});
export default defineConfig({
dev: {
setupMiddlewares: [
setupMiddlewares,
],
},
tools: {
rspack: {
plugins: [
unpluginDingtalk,
],
},
},
});