2021-01-30 15:54:52 +13:00
|
|
|
import commonjs from "@rollup/plugin-commonjs"
|
2021-01-22 05:44:03 +13:00
|
|
|
import resolve from "rollup-plugin-node-resolve"
|
|
|
|
import json from "@rollup/plugin-json"
|
2021-01-30 13:20:13 +13:00
|
|
|
import { terser } from "rollup-plugin-terser"
|
2021-04-02 04:09:16 +13:00
|
|
|
import builtins from "rollup-plugin-node-builtins"
|
|
|
|
import globals from "rollup-plugin-node-globals"
|
2024-02-22 08:45:35 +13:00
|
|
|
import typescript from "@rollup/plugin-typescript"
|
2022-09-07 19:48:29 +12:00
|
|
|
import injectProcessEnv from "rollup-plugin-inject-process-env"
|
2021-01-19 06:40:19 +13:00
|
|
|
|
2021-01-30 13:20:13 +13:00
|
|
|
const production = !process.env.ROLLUP_WATCH
|
2021-04-01 04:14:56 +13:00
|
|
|
|
2024-02-22 10:35:02 +13:00
|
|
|
const config = (format, outputFile) => ({
|
|
|
|
input: "src/index.ts",
|
|
|
|
output: {
|
|
|
|
sourcemap: !production,
|
|
|
|
format,
|
|
|
|
file: outputFile,
|
2021-04-01 04:14:56 +13:00
|
|
|
},
|
2024-02-22 10:35:02 +13:00
|
|
|
plugins: [
|
|
|
|
typescript({ tsconfig: "tsconfig.json" }),
|
|
|
|
resolve({
|
|
|
|
preferBuiltins: true,
|
|
|
|
browser: true,
|
|
|
|
}),
|
|
|
|
commonjs(),
|
|
|
|
globals(),
|
|
|
|
builtins(),
|
|
|
|
json(),
|
|
|
|
injectProcessEnv({
|
|
|
|
NO_JS: process.env.NO_JS,
|
|
|
|
}),
|
|
|
|
// production && terser(),
|
|
|
|
],
|
|
|
|
})
|
|
|
|
|
|
|
|
export default [
|
|
|
|
config("cjs", "./dist/bundle.cjs"),
|
|
|
|
config("esm", "./dist/bundle.mjs"),
|
2021-04-01 04:14:56 +13:00
|
|
|
]
|