trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

bug: bunfig.toml is not taken into account when bunding

Open capaj opened this issue 1 month ago • 1 comments

Provide environment information

System: OS: Linux 6.17 Ubuntu 25.10 25.10 (Questing Quokka) CPU: (16) x64 AMD Ryzen 7 9700X 8-Core Processor Memory: 11.27 GB / 60.44 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 22.16.0 - /home/capaj/.nvm/versions/node/v22.16.0/bin/node Yarn: 1.22.22 - /home/capaj/.yarn/bin/yarn npm: 10.9.2 - /home/capaj/.nvm/versions/node/v22.16.0/bin/npm pnpm: 10.20.0 - /home/capaj/.local/share/pnpm/pnpm bun: 1.3.1 - /home/capaj/.bun/bin/bun

Describe the bug

I want to import md files in my code using import text from './readme.md'

but this fails on build step with

25hX Error: Build failed with 2 errors:
../api/src/services/ad-generation.ts:34:40: ERROR: No loader is configured for ".md" files: ../api/src/services/prompts/headlinesDescriptionsPrompt.md
../api/src/services/ad-generation.ts:35:37: ERROR: No loader is configured for ".md" files: ../api/src/services/prompts/landingPage.md

Even though I have

[loader]
".md" = "text"

in my bunfig.toml

Reproduction repo

not necessary

To reproduce

create bunfig.toml

[loader]
".md" = "text"

create a task

import text from './readme.md'

and run:

pnpm dlx trigger.dev deploy --env staging

Additional information

No response

capaj avatar Nov 06 '25 15:11 capaj

I was able to work around with this:

import { defineConfig } from '@trigger.dev/sdk'

export default defineConfig({
  runtime: 'bun',
  dirs: ['.'],
  build: {
    extensions: [
      {
        name: 'markdown-loader',
        onBuildStart: async (context) => {
          // Configure esbuild to load .md files as text
          context.registerPlugin({
            name: 'md-text-loader',
            setup(build) {
              // Use esbuild's loader option to treat .md files as text
              build.initialOptions.loader = {
                ...build.initialOptions.loader,
                '.md': 'text'
              }
            }
          })
        }
      }
    ]
  }
})

and it seems to work ok, but a proper fix would be better

capaj avatar Nov 07 '25 12:11 capaj