Skip to content

[Bug]: Unable to parse rolldown.config.ts that are not in the working directory #3237

@eavidy

Description

@eavidy

Reproduction link or steps

build/rolldown.config.ts:

import { defineConfig } from 'rolldown'

export default defineConfig({
  input: 'main.ts',
})

run pnpm rolldown -c build/rolldown.config.ts

What is expected?

Can build main.ts

What is actually happening?

output

Error: Error happened while loading config.
    at loadConfig (file:///Users/asnow/project/study/rolldown/node_modules/.pnpm/rolldown@1.0.0-beta.1/node_modules/rolldown/dist/esm/cli.mjs:352:9)
    at async bundleWithConfig (file:///Users/asnow/project/study/rolldown/node_modules/.pnpm/rolldown@1.0.0-beta.1/node_modules/rolldown/dist/esm/cli.mjs:359:17)
    at async main (file:///Users/asnow/project/study/rolldown/node_modules/.pnpm/rolldown@1.0.0-beta.1/node_modules/rolldown/dist/esm/cli.mjs:2004:3) {
  [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/asnow/project/study/rolldown/rolldown.config.CfaagXO5.js' imported from /Users/asnow/project/study/rolldown/node_modules/.pnpm/rolldown@1.0.0-beta.1/node_modules/rolldown/dist/esm/cli.mjs
      at finalizeResolution (node:internal/modules/esm/resolve:275:11)
      at moduleResolve (node:internal/modules/esm/resolve:932:10)
      at defaultResolve (node:internal/modules/esm/resolve:1056:11)
      at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
      at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
      at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
      at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
      at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:546:36)
      at TracingChannel.tracePromise (node:diagnostics_channel:344:14)
      at ModuleLoader.import (node:internal/modules/esm/loader:545:21) {
    code: 'ERR_MODULE_NOT_FOUND',
    url: 'file:///Users/asnow/project/study/rolldown/rolldown.config.CfaagXO5.js'
  }
}

System Info

System:
    OS: macOS 14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 277.67 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/Library/pnpm/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 10.9.0 - ~/Library/pnpm/npm
    pnpm: 9.15.1 - ~/Library/pnpm/pnpm
    bun: 1.1.20 - ~/.bun/bin/bun
  Browsers:
    Edge: 131.0.2903.112
    Safari: 17.5

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions