mirror of
https://github.com/loro-dev/loro.git
synced 2024-11-28 17:41:49 +00:00
38 lines
745 B
JavaScript
38 lines
745 B
JavaScript
|
import { defineConfig } from "rollup";
|
||
|
import dts from "rollup-plugin-dts";
|
||
|
import esbuild from "rollup-plugin-esbuild";
|
||
|
import packageJson from "./package.json" assert { type: "json" };
|
||
|
|
||
|
const name = packageJson.main.replace(/\.js$/, "");
|
||
|
|
||
|
const bundle = (config) => ({
|
||
|
...config,
|
||
|
input: "src/index.ts",
|
||
|
external: (id) => !/^[./]/.test(id),
|
||
|
});
|
||
|
|
||
|
export default defineConfig([
|
||
|
bundle({
|
||
|
plugins: [esbuild()],
|
||
|
output: [
|
||
|
{
|
||
|
file: `${name}.js`,
|
||
|
format: "cjs",
|
||
|
sourcemap: true,
|
||
|
},
|
||
|
{
|
||
|
file: `${name}.mjs`,
|
||
|
format: "es",
|
||
|
sourcemap: true,
|
||
|
},
|
||
|
],
|
||
|
}),
|
||
|
bundle({
|
||
|
plugins: [dts()],
|
||
|
output: {
|
||
|
file: `${name}.d.ts`,
|
||
|
format: "es",
|
||
|
},
|
||
|
}),
|
||
|
]);
|