Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Problem with bun.sh #1973

@alec-c4

Description

@alec-c4

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)
  }
})()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions