Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with bun.sh #1973

Open
alec-c4 opened this issue Aug 12, 2024 · 0 comments
Open

Problem with bun.sh #1973

alec-c4 opened this issue Aug 12, 2024 · 0 comments

Comments

@alec-c4
Copy link

alec-c4 commented Aug 12, 2024

Here's what I did

I used standard in my rails-project with https://bun.sh package manager

$ bunx standard --fix

What I expected to happen

No error, all problems are corrected

What seems to have happened

bunx standard --fix
standard: Use JavaScript Standard Style (https://standardjs.com)
  /Users/alec/Code/Internal/CosmoPort/cosmoport/bun.config.js:11:24: 'Bun' is not defined. (no-undef)
import path from 'path'
import fs from 'fs'

const config = {
  sourcemap: 'external',
  entrypoints: ['app/javascript/application.js'],
  outdir: path.join(process.cwd(), 'app/assets/builds')
}

const build = async (config) => {
  const result = await Bun.build(config) /// <----- problem on this line with Bun

  if (!result.success) {
    if (process.argv.includes('--watch')) {
      console.error('Build failed')
      for (const message of result.logs) {
        console.error(message)
      }
    } else {
      throw new AggregateError(result.logs, 'Build failed')
    }
  }
};

(async () => {
  await build(config)

  if (process.argv.includes('--watch')) {
    fs.watch(path.join(process.cwd(), 'app/javascript'), { recursive: true }, (eventType, filename) => {
      console.log(`File changed: ${filename}. Rebuilding...`)
      build(config)
    })
  } else {
    process.exit(0)
  }
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant