Skip to content

Commit

Permalink
build(api): do not use async import as it bundles everything
Browse files Browse the repository at this point in the history
Using an async import causes all of the imported things to be added to
the bundle, ignoring the `sideEffects` settings in `package.json` files
of the packages. This meant that we were including `nock` and `fishery`
from `packages/tmdb` in the bundle...

Since everything is bundled into one file anyways, then the dynamic
import doesn't actually do anything useful.

Related to #83
  • Loading branch information
JoosepAlviste committed Jan 13, 2024
1 parent 6eba54f commit be79022
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"type": "module",
"sideEffects": [
"./src/**/*.schema.ts",
"./src/lib/initSentry.ts"
"./src/lib/initSentry.ts",
"./src/**/*.job.ts"
],
"scripts": {
"build": "rimraf dist && NODE_ENV=production tsx bin/build.ts",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/features/series/seriesSync.job.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { createQueue, createWorker } from '#/lib/bullMq'
import { db } from '#/lib/db'

import { reSyncSeries } from './series.service'

export const seriesSyncQueue = createQueue('seriesSync')

const SERIES_SYNC_JOB = 'seriesSync'
Expand All @@ -18,8 +20,6 @@ await seriesSyncQueue.add(
export const seriesSyncWorker = createWorker(
SERIES_SYNC_JOB,
async () => {
const { reSyncSeries } = await import('./series.service')

await reSyncSeries({ ctx: { db } })
},
{ autorun: false },
Expand Down

0 comments on commit be79022

Please sign in to comment.