first commit

This commit is contained in:
2026-02-23 16:25:54 +08:00
commit 328786d9e1
78 changed files with 20840 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
import ts from "rollup-plugin-ts"
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser'
import nodePolyfills from 'rollup-plugin-polyfill-node'
import serve from 'rollup-plugin-serve';
import bable from 'rollup-plugin-babel'
export default {
input: "./src/index.ts",
plugins: [
bable({
exclude:'node_modules'
}),
nodePolyfills(),//打包node内置模块浏览器端使用如events
resolve({ browser: true }),//加载第三方模块
commonjs(),//common转esm
ts({ tsconfig: "tsconfig.json" }),//typescript support
terser(), //minify the code and remove comments
process.env.ENV === "development" ? serve({
port: 13200,
contentBase: ["example", "."], // 静态资源所在目录
}) : null
],
output: [
{
format: "umd",//umd format
file: "dist/index.js", //output
name: "UscRtc", //name of umd
exports: "named",//remove export default warning
sourcemap: true
},
{
format: "esm",//esm format
file: "dist/index.esm.js",//output file
sourcemap: true
},
{
format: "cjs",//umd format
file: "dist/index.cjs.js", //output
name: "bundleName", //name of umd
exports: "named",//remove export default warning
sourcemap: true
},
{
format: "umd",//umd format
file: "example/index.js", //打包到示例demo中
name: "UscRtc", //name of umd
exports: "named",//remove export default warning
sourcemap: true
},
{
format: "esm",//esm format
file: "example/index.esm.js",//打包到示例demo中
sourcemap: true
}, {
format: "cjs",//umd format
file: "example/index.cjs.js", //output
name: "bundleName", //name of umd
exports: "named",//remove export default warning
sourcemap: true
},
],
}