A build plugin based on unplugin that automatically uploads files to JD OSS after build completion.
It supports multiple build tools, including Vite, Webpack, Rspack, Rollup, Rolldown, esbuild and Farm. The plugin integrates @jd/upload-oss-tools and automatically performs uploads in the writeBundle hook, eliminating the need for manual deployment of static assets.
npm i -D -E unplugin-jdoss- Automatic OSS Upload - Automatically uploads build artifacts to JD OSS after build completion via the
writeBundlehook - Multi-Builder Support - Works seamlessly with Vite, Webpack, Rspack, Rollup, Rolldown, esbuild, and Farm
- Zero Configuration - Integrates with
@jd/upload-oss-toolsout of the box, no manual deployment needed - Build Tool Agnostic - Built on unplugin for universal compatibility across modern build tools
- Static Asset Deployment - Eliminates the need for manual static asset deployment workflows
/// vite.config.ts
import path from 'node:path'
import VitePluginJdoss from 'unplugin-jdoss/vite'
import { defineConfig, loadEnv, searchForWorkspaceRoot } from 'vite'
export default defineConfig(({ mode }) => {
const workspaceRoot = searchForWorkspaceRoot(process.cwd())
const env = loadEnv(mode, workspaceRoot)
return {
base: env.VITE_BASE_URL,
plugins: [
mode === 'production' &&
VitePluginJdoss({
localFullPath: path.resolve(workspaceRoot, 'dist'),
access: env.VITE_OSS_ACCESS,
secret: env.VITE_OSS_SECRET,
site: 'storage.jd.local',
cover: true,
timeout: '30000',
printCdnFile: false,
bucket: env.VITE_OSS_BUCKET,
folder: env.VITE_OSS_FOLDER,
ignoreRegexp: '',
}),
],
}
})- Rollup
- Vite
- Webpack
- Esbuild
- Rspack
- Farm
- Rolldown
- Bun
MIT License © 2026-PRESENT Benjamin He