oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.18k stars 2.77k forks source link

Fix `"imports"` with wildcard #1402

Open Jarred-Sumner opened 2 years ago

Jarred-Sumner commented 2 years ago

It doesn't work right now and needs to be fixed

jpaquim commented 2 years ago

@Jarred-Sumner I'm picking this up, looking through the esbuild codebase I guess what needs to be implemented is the equivalent of this recent commit: https://github.com/evanw/esbuild/commit/efd0af66bfb06eb3f46e961aa35920eb90df602d#diff-e83ac59d438ffaac520365377e7732293f841b732b262f1acf804b4da7e7a7ff

jpaquim commented 1 year ago

Should this issue be closed as well? Or after https://github.com/oven-sh/bun/pull/1538 is merged?

vjpr commented 1 year ago

Has anymore work been done on this? Is #1538 the latest branch?

vjpr commented 1 year ago

TypeScript path mappings are a good workaround for now.

https://bun.sh/docs/runtime/typescript#path-mapping

{
  "compilerOptions": {
    "paths": {
      "#src/*": ["./src/*"]
    },
  }
}
matinzd commented 1 year ago

@jpaquim It seems that wildcards are still not supported on bun v1.0:

{
  "extends": "@tsconfig/react-native/tsconfig.json",
  "compilerOptions": {
    "skipLibCheck": true,
    "isolatedModules": false,
    "paths": {
      "@assets/*": ["./assets/*"],
      "@hava/*": ["./src/*"],
      "@hava-tests/*": ["./__tests__/*"]
    }
  }
}

Error:

error: Cannot find module "@hava/api" from "/Users/matin/work/hava-app/src/index.tsx"
Juan-Esc commented 9 months ago

Any update on this issue? This is a blocker issue to move from Parcel and other bundlers to Bun Bundler