1 Star 0 Fork 41

benyuanzhang/jswebrtc

forked from zensoft/jswebrtc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.mts 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
qwecxzpoi 提交于 2023-12-02 00:21 +08:00 . chore: update
import fs from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'rollup'
import esbuild from 'rollup-plugin-esbuild'
import { dts } from 'rollup-plugin-dts'
import fg from 'fast-glob'
const cwd = fileURLToPath(new URL('.', import.meta.url))
const pkg = JSON.parse(await fs.readFile(new URL('./package.json', import.meta.url), 'utf-8'))
const rulesEntry = await fg('./src/**/*.ts', {
cwd,
onlyFiles: true,
ignore: [
'**/index.ts',
'**/*.test.ts',
'**/*.d.ts',
],
})
const tsEntry = await fg('./src/**/*.d.ts', {
cwd,
onlyFiles: true,
ignore: [
'**/index.ts',
'**/index.test.ts',
],
})
const input = [
'./src/index.ts',
...rulesEntry.filter(i => !i.includes('.d.ts')),
]
export default defineConfig([
{
input,
output: [
{
generatedCode: 'es2015',
dir: 'dist',
format: 'es',
manualChunks(id) {
if (id.includes('src/index')) {
return '.'
}
},
chunkFileNames: '[name].js',
},
],
plugins: [
esbuild(),
],
external: [
...Object.keys(pkg.dependencies || []),
...Object.keys(pkg.peerDependencies || []),
],
},
{
input: tsEntry,
output: [
{
dir: 'dist/types',
},
],
plugins: [
dts(),
],
},
])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/benyuanzhang/jswebrtc.git
git@gitee.com:benyuanzhang/jswebrtc.git
benyuanzhang
jswebrtc
jswebrtc
master

搜索帮助