https://github.com/ohbug-org/unplugin-ohbug
plugin for upload your sourceMap files to Ohbug
https://github.com/ohbug-org/unplugin-ohbug
Last synced: about 1 month ago
JSON representation
plugin for upload your sourceMap files to Ohbug
- Host: GitHub
- URL: https://github.com/ohbug-org/unplugin-ohbug
- Owner: ohbug-org
- License: apache-2.0
- Created: 2021-09-13T08:00:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-29T06:22:21.000Z (over 2 years ago)
- Last Synced: 2025-02-14T09:37:57.408Z (3 months ago)
- Language: TypeScript
- Size: 331 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-zh_CN.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# `@ohbug/unplugin`
[](https://www.npmjs.com/package/@ohbug/unplugin)
[](https://bundlephobia.com/result?p=@ohbug/unplugin)[English](./README.md) | 简体中文
为 Vite, Webpack 和 Rollup 自动上传 sourceMap 文件至 Ohbug. 由 [unplugin](https://github.com/unjs/unplugin) 驱动.
## 安装
```
npm install @ohbug/unplugin -D
```## 使用
Vite
```ts
// vite.config.ts
import OhbugUnplugin from '@ohbug/unplugin/vite'export default defineConfig({
plugins: [
OhbugUnplugin({
apiKey: 'YOUR_API_KEY',
appVersion: 'YOUR_APP_VERSION',
}),
],
})
```Example: [`playground/`](./playground/)
Rollup
```ts
// rollup.config.js
import OhbugUnplugin from '@ohbug/unplugin/rollup'export default {
plugins: [
OhbugUnplugin({
apiKey: 'YOUR_API_KEY',
appVersion: 'YOUR_APP_VERSION',
}),
// other plugins
],
}
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('@ohbug/unplugin/webpack')({
apiKey: 'YOUR_API_KEY',
appVersion: 'YOUR_APP_VERSION',
}),
],
}
```
Nuxt
```ts
// nuxt.config.js
export default {
buildModules: [
[
'@ohbug/unplugin/nuxt',
{
apiKey: 'YOUR_API_KEY',
appVersion: 'YOUR_APP_VERSION',
},
],
],
}
```> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)
Vue CLI
```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('@ohbug/unplugin/webpack')({
apiKey: 'YOUR_API_KEY',
appVersion: 'YOUR_APP_VERSION',
}),
],
},
}
```
esbuild
```ts
// esbuild.config.js
import { build } from 'esbuild'
import Starter from '@ohbug/unplugin/esbuild'build({ plugins: [Starter()] })
```
## Options
```typescript
interface Options {
apiKey: string
appVersion: string
appType?: string
endpoint?: string
deleteAfterUploading?: boolean
}
```### apiKey
这里作为客户端的唯一标识。
### appVersion
您应该提供 app 的版本号/标识符,以便于定位问题出现的时机。
### appType
如果您的 app 的代码库包含不同的入口,但向同一个服务上报,则可能需要添加 `appType` 表示问题来源的入口类型。
### endpoint
上传服务器的 URL
### deleteAfterUploading
上传后删除 sourceMap 默认为 `false`