diff --git a/packages/server/package.json b/packages/server/package.json index 59bdf736ae..31f4a879a4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -181,6 +181,16 @@ "target": "build" } ] + }, + "test": { + "dependsOn": [ + { + "projects": [ + "@budibase/string-templates" + ], + "target": "build:esbuild" + } + ] } } } diff --git a/packages/server/src/jsRunner.ts b/packages/server/src/jsRunner.ts index cdc619ebc0..967a9ed51c 100644 --- a/packages/server/src/jsRunner.ts +++ b/packages/server/src/jsRunner.ts @@ -3,10 +3,10 @@ import env from "./environment" import { setJSRunner } from "@budibase/string-templates" import { context } from "@budibase/backend-core" import tracer from "dd-trace" -import { readFileSync } from "fs" +import fs from "fs" -const helpersSource = readFileSync( - "node_modules/@budibase/string-templates/dist/bundle.mjs", +const helpersSource = fs.readFileSync( + `${require.resolve("@budibase/string-templates/index-helpers")}`, "utf8" ) diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index cb63ad0a29..953aecc379 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -11,7 +11,8 @@ "require": "./src/index.cjs", "import": "./dist/bundle.mjs" }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./index-helpers": "./dist/index-helpers.bundled.js" }, "files": [ "dist",