beesbuild
Version:
构建工具链
23 lines (22 loc) • 633 B
JavaScript
import replace from "@rollup/plugin-replace";
import { isBoolean, mergeWith } from "lodash-unified";
const replacePlugin = (option, ctx) => {
var _a, _b, _c, _d;
if ((option != null ? option : false) === false) return [];
if (isBoolean(option)) {
option = {};
}
const values = mergeWith(
{},
(_c = (_b = (_a = ctx == null ? void 0 : ctx.options) == null ? void 0 : _a.replace) == null ? void 0 : _b.values) != null ? _c : {},
(_d = option == null ? void 0 : option.values) != null ? _d : {}
);
return replace({
preventAssignment: true,
...option,
values
});
};
export {
replacePlugin
};