Update string-templates to use a better node polyfill rollup plugin

This commit is contained in:
Andrew Kingston 2021-03-31 19:07:09 +01:00
parent a2bd824a1d
commit 369a0d6c7a
2 changed files with 16 additions and 17 deletions

View File

@ -2,7 +2,7 @@
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "0.8.9", "version": "0.8.9",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "dist/bundle.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@ -32,9 +32,8 @@
"jest": "^26.6.3", "jest": "^26.6.3",
"marked": "^2.0.0", "marked": "^2.0.0",
"rollup": "^2.36.2", "rollup": "^2.36.2",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-polyfill-node": "^0.6.2",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"typescript": "^4.1.3" "typescript": "^4.1.3"
}, },

View File

@ -2,8 +2,7 @@ import commonjs from "@rollup/plugin-commonjs"
import resolve from "rollup-plugin-node-resolve" import resolve from "rollup-plugin-node-resolve"
import json from "@rollup/plugin-json" import json from "@rollup/plugin-json"
import { terser } from "rollup-plugin-terser" import { terser } from "rollup-plugin-terser"
import builtins from "rollup-plugin-node-builtins" import polyfillNode from "rollup-plugin-polyfill-node"
import globals from "rollup-plugin-node-globals"
const production = !process.env.ROLLUP_WATCH const production = !process.env.ROLLUP_WATCH
@ -13,8 +12,7 @@ const plugins = [
preferBuiltins: true, preferBuiltins: true,
}), }),
commonjs(), commonjs(),
builtins(), polyfillNode(),
globals(),
production && terser(), production && terser(),
json(), json(),
] ]
@ -29,14 +27,16 @@ export default [
}, },
plugins, plugins,
}, },
{ // This is the valid configuration for a CommonJS bundle, but since we have
input: "src/index.cjs", // no use for this, it's better to leave it out.
output: { // {
sourcemap: !production, // input: "src/index.cjs",
format: "cjs", // output: {
file: "./dist/bundle.cjs", // sourcemap: !production,
exports: "named", // format: "cjs",
}, // file: "./dist/bundle.cjs",
plugins, // exports: "named",
}, // },
// plugins,
// },
] ]