You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support + docs for custom esbuild plugins (#1270)
* Add support + docs for custom esbuild plugins
* Fixed the missing subpath export
* Add support for specifying the prisma client generator
* Add `—env-file` support to dev and deploy
Copy file name to clipboardExpand all lines: docs/guides/new-build-system-preview.mdx
+154Lines changed: 154 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,8 @@ If you've added the `trigger.dev` CLI to your `devDependencies`, then you should
39
39
40
40
Once you do that make sure you re-install your dependencies using `npm i` or the equivalent with your preferred package manager.
41
41
42
+
<Note>If you deploy using GitHub actions, make sure you update the version there too.</Note>
43
+
42
44
## Update your `trigger.config.ts`
43
45
44
46
The new build system does not effect your trigger task files at all, so those can remain unchanged. However, you may need to make changes to your `trigger.config.ts` file.
If you have multiple `generator` statements defined in your schema file, you can pass in the `clientGenerator` option to specify the `prisma-client-js` generator, which will prevent other generators from being generated:
235
+
236
+
<CodeGroup>
237
+
238
+
```prisma schema.prisma
239
+
datasource db {
240
+
provider = "postgresql"
241
+
url = env("DATABASE_URL")
242
+
directUrl = env("DATABASE_URL_UNPOOLED")
243
+
}
244
+
245
+
// We only want to generate the prisma-client-js generator
You can now add esbuild plugins to customize the build process using the `esbuildPlugin` build extension. The example below shows how to automatically upload sourcemaps to Sentry using their esbuild plugin:
// optional - only runs during the deploy command, and adds the plugin to the end of the list of plugins
313
+
{ placement: "last", target: "deploy" }
314
+
),
315
+
],
316
+
},
317
+
});
318
+
```
319
+
320
+
## Changes to the `trigger.dev` CLI
321
+
322
+
### No more typechecking during deploy
323
+
324
+
We no longer run typechecking during the deploy command. This was causing issues with some projects, and we found that it wasn't necessary to run typechecking during the deploy command. If you want to run typechecking before deploying to Trigger.dev, you can run the `tsc` command before running the `deploy` command.
This will save the build output and print the path to the build output directory. If you face any issues with deploying, please include the build output in your issue report.
355
+
356
+
### --env-file
357
+
358
+
You can now pass the path to your local `.env` file using the `--env-file` flag during `dev` and `deploy` commands:
359
+
360
+
```sh
361
+
npx trigger.dev@0.0.0-prerelease-20240823132052 dev --env-file ../../.env
The `.env` file works slightly differently in `dev` vs `deploy`:
366
+
367
+
- In `dev`, the `.env` file is loaded into the CLI's `process.env` and also into the environment variables of the Trigger.dev environment.
368
+
- In `deploy`, the `.env` file is loaded into the CLI's `process.env` but not into the environment variables of the Trigger.dev environment. If you want to sync the environment variables from the `.env` file to the Trigger.dev environment variables, you can use the `syncEnvVars` build extension.
369
+
370
+
### dev debugging in VS Code
371
+
372
+
Debugging your tasks code in `dev` is now supported via VS Code, without having to pass in any additional flags. Create a launch configuration in `.vscode/launch.json`:
Then you can start debugging your tasks code by selecting the `Trigger.dev: Dev` configuration in the debug panel, and set breakpoints in your tasks code.
393
+
394
+
### TRIGGER_ACCESS_TOKEN in dev
395
+
396
+
You can now authenticate the `dev` command using the `TRIGGER_ACCESS_TOKEN` environment variable. Previously this was only supported in the `deploy` command.
397
+
398
+
```sh
399
+
TRIGGER_ACCESS_TOKEN=<your access token> npx trigger.dev@0.0.0-prerelease-20240823132052 dev
400
+
```
401
+
248
402
## Known issues
249
403
250
404
- Path aliases are not yet support in your `trigger.config.ts` file. To workaround this issue you'll need to rewrite path aliases to their relative paths. (See [this](https://github.com/unjs/jiti/issues/166) and [this](https://knip.dev/reference/known-issues#path-aliases-in-config-files)) for more info.
0 commit comments