relay-plugin-rollup-preset/dist/index.js

24 lines
866 B
JavaScript
Raw Normal View History

2022-12-14 14:54:58 +00:00
import { defineConfig } from "rollup";
import commonjs from "@rollup/plugin-commonjs";
2023-01-01 17:40:32 +00:00
import { nodeResolve, } from "@rollup/plugin-node-resolve";
2022-12-14 14:54:58 +00:00
import { bundleNativeModulesPlugin } from "@lumeweb/rollup-plugin-bundle-native-modules";
2022-12-14 15:04:02 +00:00
import typescript from "@rollup/plugin-typescript";
import json from "@rollup/plugin-json";
2023-01-01 17:40:32 +00:00
// @ts-ignore
import merger from "object-merger";
export default function preset(globalOptions, resolveOptions = {}, commonJsOptions = {}) {
return merger(globalOptions, defineConfig({
2022-12-14 17:33:15 +00:00
plugins: [
typescript(),
json(),
2022-12-14 18:14:24 +00:00
bundleNativeModulesPlugin(),
2023-01-01 17:17:02 +00:00
nodeResolve({
mainFields: ["main"],
exportConditions: ["node", "require", "default"],
2023-01-01 17:40:32 +00:00
...resolveOptions,
2023-01-01 17:17:02 +00:00
}),
2023-01-01 17:40:32 +00:00
commonjs(commonJsOptions),
2022-12-14 17:33:15 +00:00
],
2023-01-01 17:40:32 +00:00
}));
2022-12-14 15:22:16 +00:00
}