2 Star 12 Fork 7

孔乙己拉夫米/zh-chess

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.js 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
孔乙己拉夫米 提交于 2023-07-10 17:03 . 调整polyfill
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
import { terser } from "rollup-plugin-terser";
import commonjs from "@rollup/plugin-commonjs";
import pkg from './package.json';
import { resolve } from "path"
const outDir = resolve(".", "lib")
const libs = [
{// 浏览器导入
ext: ".browser.js",
name: toHump(pkg.name),
format: "iife",
exports: 'named',
plugins: [
typescript({ sourceMap: false, target: "es5" }),
]
},
{// 浏览器压缩版
ext: ".browser.min.js",
name: toHump(pkg.name),
format: "iife",
exports: 'named',
plugins: [
typescript({ sourceMap: false, target: "es5" }),
terser(),
]
},
{// nodejs
ext: ".cjs.js",
format: "cjs",
exports: 'named',
plugins: [
typescript({ sourceMap: false, }),
]
},
{// esm
ext: ".es.js",
format: "esm",
plugins: [
typescript({ sourceMap: false, }),
]
},
{// .d.ts
ext: ".d.ts",
format: "esm",
plugins: [
dts()
]
}
]
export default libs.map(item => {
return {
input: "./src/index.ts",
output: {
format: item.format,
name: item.name,
exports: item.exports,
file: resolve(outDir, pkg.name + item.ext)
},
plugins: [
nodeResolve(),
commonjs(),
...item.plugins
],
}
})
function toHump(name) {
return name.replace(/^(\w)/, function (a, w) {
return w.toUpperCase()
}).replace(/\-(\w)/g, function (all, letter) {
return letter.toUpperCase();
});
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/kong_yiji_and_lavmi/zh-chess.git
git@gitee.com:kong_yiji_and_lavmi/zh-chess.git
kong_yiji_and_lavmi
zh-chess
zh-chess
v2.0

搜索帮助