Skip to content

Commit ff435fb

Browse files
samejrmatt-aitken
authored andcommitted
Added depenenciesToBundle guide to bundle all packages
1 parent 41c551d commit ff435fb

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

docs/snippets/bundle-packages.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Tabs>
2+
<Tab title="Bundle everything">
3+
4+
Bundle all ESM packages so that you don't have to specifiy them manually like this:
5+
6+
```ts trigger.config.ts
7+
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
8+
9+
export const config: TriggerConfig = {
10+
//..other stuff
11+
dependenciesToBundle: [/.*/],
12+
};
13+
```
14+
15+
</Tab>
16+
<Tab title="Bundle individual packages">
17+
18+
Bundle individual packages using strings or regex like this:
19+
20+
```ts trigger.config.ts
21+
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
22+
23+
export const config: TriggerConfig = {
24+
//..other stuff
25+
//either regex or strings of package names
26+
dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"],
27+
};
28+
```
29+
30+
</Tab>
31+
</Tabs>

docs/trigger-config.mdx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebarTitle: "trigger.config file"
44
description: "This file is used to configure your project and how it's bundled."
55
---
66

7+
import BundlePackages from '/snippets/bundle-packages.mdx';
8+
79
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.
810

911
```ts trigger.config.ts
@@ -110,15 +112,7 @@ You can sync environment variables from another service using the `resolveEnvVar
110112

111113
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.
112114

113-
```ts trigger.config.ts
114-
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
115-
116-
export const config: TriggerConfig = {
117-
//..other stuff
118-
//either regex or strings of package names
119-
dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"],
120-
};
121-
```
115+
<BundlePackages/>
122116

123117
## Prisma (and other generators)
124118

docs/troubleshooting.mdx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: "Common problems"
33
description: "Some common problems you might experience and their solutions"
44
---
55

6+
import BundlePackages from '/snippets/bundle-packages.mdx';
7+
68
## Development
79

810
### `EACCES: permission denied`
@@ -44,17 +46,7 @@ You can skip typechecking, by adding the `--skip-typecheck` flag when calling de
4446

4547
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).
4648

47-
Like this:
48-
49-
```ts trigger.config.ts
50-
import type { TriggerConfig } from "@trigger.dev/sdk/v3";
51-
52-
export const config: TriggerConfig = {
53-
//..other stuff
54-
//either regex or strings of package names
55-
dependenciesToBundle: [/@sindresorhus/, "escape-string-regexp"],
56-
};
57-
```
49+
<BundlePackages/>
5850

5951
### `Failed to build project image: Error building image`
6052

0 commit comments

Comments
 (0)