Files
gd_water_websdk/hs-web3d-core/rollup.config.js
2026-02-23 16:25:54 +08:00

66 lines
2.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
},
],
}