Added depenenciesToBundle guide to bundle all packages

This commit is contained in:
James Ritchie
2024-08-13 17:06:38 +01:00
parent f1ffc2e6c8
commit 2088fa392d
3 changed files with 37 additions and 20 deletions
+31
View File
@@ -0,0 +1,31 @@
<Tabs>
<Tab title="Bundle everything">
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: [/.*/],
};
```
</Tab>
<Tab title="Bundle individual packages">
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"],
};
```
</Tab>
</Tabs>
+3 -9
View File
@@ -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"],
};
```
<BundlePackages/>
## Prisma (and other generators)
+3 -11
View File
@@ -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"],
};
```
<BundlePackages/>
### `Failed to build project image: Error building image`