oven-sh / bun

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

bun run dev errors out on first run after changes, rerunning works #10373

Open alexandermorgan opened 4 months ago

alexandermorgan commented 4 months ago

What version of Bun is running?

1.1.4+fbe2fe0c3

What platform is your computer?

Darwin 22.4.0 arm64 arm

What steps can reproduce the bug?

I recently started getting errors running bun run dev for the first time after making changes. The error happens on the first script line of my main +page.svelte file, which is an import from the capacitorjs library. Rerunning the same command immediately without making any changes works fine. bun run build works without issue.

What is the expected behavior?

I expect bun run dev to work on the first try after I make changes (assuming my changes are not problematic).

What do you see instead?

The first bun run dev after changes raises this error after navigating to the tab:

bun run dev
$ vite dev

  VITE v5.2.9  ready in 507 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
5:25:38 PM [vite] Pre-transform error: [postcss] /REDACTED/src/routes/+page.svelte?svelte&type=style&lang.css:2:12: Unknown word
5:25:38 PM [vite] Internal server error: [postcss] /REDACTED/src/routes/+page.svelte?svelte&type=style&lang.css:2:12: Unknown word
  Plugin: vite:css
  File: /REDACTED/src/routes/+page.svelte?svelte&type=style&lang.css:2:11
  1  |  <script>
  2  |    import { Capacitor } from '@capacitor/core'
     |             ^
  3  |    import { StatusBar, Style } from '@capacitor/status-bar'
  4  |    import { Preferences } from '@capacitor/preferences'
      at Input.error (/REDACTED/node_modules/postcss/lib/input.js:106:16)
      at Parser.unknownWord (/REDACTED/node_modules/postcss/lib/parser.js:593:22)
      at Parser.other (/REDACTED/node_modules/postcss/lib/parser.js:435:12)
      at Parser.parse (/REDACTED/node_modules/postcss/lib/parser.js:470:16)
      at parse (/REDACTED/node_modules/postcss/lib/parse.js:11:12)
      at new LazyResult (/REDACTED/node_modules/postcss/lib/lazy-result.js:133:16)
      at Processor.process (/REDACTED/node_modules/postcss/lib/processor.js:53:14)
      at compileCSS (file:///REDACTED/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:32262:63)
      at async TransformContext.transform (file:///REDACTED/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:31573:56)
      at async Object.transform (file:///REDACTED/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:51186:30)
^C

Additional information

Bun is an inspiration! Many thanks 🙏

Electroid commented 4 months ago

Are you able to narrow down the exact issue, or share your code? Otherwise it will be difficult for us to reproduce this.

alexandermorgan commented 4 months ago

I haven't been able to narrow it down yet. It's fine to close this and I'll recomment on it if I find something more concrete I can share.

github-actions[bot] commented 1 month ago

This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.