加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.js 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
江夏尧 提交于 2022-08-24 22:34 . feat: 优化输出问题
import analyze from "rollup-plugin-analyzer";
import json from "@rollup/plugin-json";
import babel from "@rollup/plugin-babel";
import { outputFileSync } from "fs-extra";
import { emptyDirSync } from "fs-extra";
import resolve from "@rollup/plugin-node-resolve";
emptyDirSync("./dist/");
export default {
external: [],
input: "./src/index.ts",
output: {
dir: "./dist/",
format: "es",
paths: {},
},
plugins: [
json({
namedExports: false,
}),
{
transform(code, id) {
if (id.endsWith(".html")) {
return `export default \`${Buffer.from(code).toString(
"base64"
)}\``;
}
},
},
babel({
extensions: [".ts"],
babelHelpers: "bundled",
}),
resolve({
extensions: [".ts"],
moduleDirectories: [],
}),
analyze({
summaryOnly: true,
writeTo: (str) => outputFileSync("dist/index.analyze.txt", str),
}),
],
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化