From 2088fa392d9c60e2312eea38368ffa3bc759da68 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Tue, 13 Aug 2024 17:06:38 +0100 Subject: [PATCH] Added depenenciesToBundle guide to bundle all packages --- docs/snippets/bundle-packages.mdx | 31 +++++++++++++++++++++++++++++++ docs/trigger-config.mdx | 12 +++--------- docs/troubleshooting.mdx | 14 +++----------- 3 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 docs/snippets/bundle-packages.mdx diff --git a/docs/snippets/bundle-packages.mdx b/docs/snippets/bundle-packages.mdx new file mode 100644 index 000000000..a4477b5b5 --- /dev/null +++ b/docs/snippets/bundle-packages.mdx @@ -0,0 +1,31 @@ + + + + Bundle all ESM packages so that you don't have to specifiy them manually like this: + + ```ts trigger.config.ts + import type { TriggerConfig } from "@trigger.dev/sdk/v3"; + + export const config: TriggerConfig = { + //..other stuff + dependenciesToBundle: [/.*/], + }; + ``` + + + + + Bundle individual packages using strings or regex like this: + + ```ts trigger.config.ts + import type { TriggerConfig } from "@trigger.dev/sdk/v3"; + + export const config: TriggerConfig = { + //..other stuff + //either regex or strings of package names + dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"], + }; + ``` + + + \ No newline at end of file diff --git a/docs/trigger-config.mdx b/docs/trigger-config.mdx index 360cb9557..15e8cd40a 100644 --- a/docs/trigger-config.mdx +++ b/docs/trigger-config.mdx @@ -4,6 +4,8 @@ sidebarTitle: "trigger.config file" description: "This file is used to configure your project and how it's bundled." --- +import BundlePackages from '/snippets/bundle-packages.mdx'; + Let's take a look at a basic `trigger.config.ts` file. This is generated for you when you follow [the quick start guide](/quick-start). This file is used to configure your project and how it's bundled. ```ts trigger.config.ts @@ -110,15 +112,7 @@ You can sync environment variables from another service using the `resolveEnvVar We'll let you know when running the CLI dev command if this is a problem. Some packages are ESM-only so they don't work directly from CJS when using Node.js. In that case you need to add them to the `dependenciesToBundle` array in your `trigger.config.ts` file. -```ts trigger.config.ts -import type { TriggerConfig } from "@trigger.dev/sdk/v3"; - -export const config: TriggerConfig = { - //..other stuff - //either regex or strings of package names - dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"], -}; -``` + ## Prisma (and other generators) diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdx index 0dd5871ba..8d82d9447 100644 --- a/docs/troubleshooting.mdx +++ b/docs/troubleshooting.mdx @@ -3,6 +3,8 @@ title: "Common problems" description: "Some common problems you might experience and their solutions" --- +import BundlePackages from '/snippets/bundle-packages.mdx'; + ## Development ### `EACCES: permission denied` @@ -44,17 +46,7 @@ You can skip typechecking, by adding the `--skip-typecheck` flag when calling de This errors occurs if we can't figure out how to automatically import some code. You can fix this by adding it to the `dependenciesToBundle` array in the [trigger.config file](/trigger-config). -Like this: - -```ts trigger.config.ts -import type { TriggerConfig } from "@trigger.dev/sdk/v3"; - -export const config: TriggerConfig = { - //..other stuff - //either regex or strings of package names - dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"], -}; -``` + ### `Failed to build project image: Error building image`