oven-sh / bun

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

Missing Esbuild plugin API options (resolveDir, pluginData) #8994

Open navidemad opened 7 months ago

navidemad commented 7 months ago

What version of Bun is running?

1.0.27+c34bbb2e3

What platform is your computer?

Darwin 23.3.0 arm64 arm

What steps can reproduce the bug?

❯ rails new bun-plugin-rails-app-test --skip-action-mailer --skip-action-mailbox --skip-action-text --skip-active-record --skip-active-job --skip-active-storage --skip-action-cable --skip-jbuilder --skip-test --skip-system-test -j bun --main
❯ cd bun-plugin-rails-app-test
❯ bun add esbuild-rails
❯ mkdir -p app/javascript/public
❯ echo 'console.log(new Date().toTimeString());' >> app/javascript/public/test.js
❯ echo 'import "./**/*.js";' >> app/javascript/application.js

Add the import and modify the config into bun.config.js:

import rails from 'esbuild-rails'
const config = {
  sourcemap: "external",
  entrypoints: ["app/javascript/application.js"],
  naming: { chunk: "[name]-[hash].digested" },
  splitting: true,
  format: "esm",
  outdir: path.join(process.cwd(), "app/assets/builds"),
  plugins: [ rails() ]
};

Console output in older version of bun:

❯ bun bun.config.js
error: undefined is not an object (evaluating 'args.pluginData.path')
/Users/dev/code/bun-plugin-rails-app-test/undefined/**/*.js:1:0 0

In the latest i got:

error: "paths[0]" property must be of type string, got undefined
at /Users/dev/code/bun-plugin-rails-app-test/app/javascript/application.js:1:0`

Which is referring to import "./**/*.js";

What is the expected behavior?

https://github.com/excid3/esbuild-rails/issues/23

Compiling without error and showing us the console.log in the browser. Is it on your roadmap to implement those or need additional informations ?

What do you see instead?

No response

Additional information

https://github.com/excid3/esbuild-rails/issues/23#issuecomment-1715835168 @Jarred-Sumner is aware of this issue, but i was wondering if it went into the roadmap or not yet

navidemad commented 4 months ago

up Is there any updates related to that, it's the only think making me impossible to switch to bun. Thanks.

navidemad commented 3 months ago

Hi 👋🏻 UP only blocker for us to migrate to bun, thanks.

navidemad commented 2 weeks ago

Hello, thanks for your work, can we have some update on this issue ?