1
0
Fork 0
mirror of synced 2024-08-21 21:11:23 +12:00
budibase/packages/string-templates/rollup.config.js

45 lines
1.2 KiB
JavaScript

import commonjs from "@rollup/plugin-commonjs"
import resolve from "rollup-plugin-node-resolve"
import builtins from "rollup-plugin-node-builtins"
import globals from "rollup-plugin-node-globals"
import json from "@rollup/plugin-json"
import replace from "@rollup/plugin-replace"
import { terser } from "rollup-plugin-terser"
const production = !process.env.ROLLUP_WATCH
export default {
input: "src/esIndex.js",
output: [
{
sourcemap: true,
format: "esm",
file: "./dist/bundle.js",
name: "templates",
exports: "named",
},
],
plugins: [
// this replacement is a crazy hack to fix an issue that
// rollup has with the handlebars-helper package
// if we don't do this then the browser will always error
// with the isNumber function being unavailable
replace({
include: [
"node_modules/handlebars-helpers/lib/**",
"node_modules/handlebar-utils/lib/**",
],
"utils.isNumber(": "!isNaN(",
"isNumber(": "!isNaN(",
}),
resolve({
mainFields: ["module", "main"],
preferBuiltins: true,
browser: true,
}),
commonjs(),
globals(),
builtins(),
production && terser(),
json(),
],
}