当打包器构建发生错误时发送原生通知,由 unplugin 和 node-notifier 强力驱动
English | 简体中文
npm i unplugin-notifier
查看 node-notifier
的要求的依赖 ,以确定是否需要为系统安装额外的库。
Vite
// vite.config.ts
import Notifier from 'unplugin-notifier/vite'
export default defineConfig({
plugins: [
Notifier({ /* options */ }),
],
})
Example: playground/
Rollup
// rollup.config.js
import Notifier from 'unplugin-notifier/rollup'
export default {
plugins: [
Notifier({ /* options */ }),
],
}
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-notifier/webpack')({ /* options */ })
]
}
Nuxt
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-notifier/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
Vue CLI
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-notifier/webpack')({ /* options */ }),
],
},
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
import Notifier from 'unplugin-notifier/esbuild'
build({
plugins: [Notifier()],
})
Rspack (⚠️ 实验性)
// rspack.config.js
module.exports = {
plugins: [
require('unplugin-notifier/rspack')({ /* options */ }),
],
}