oven-sh / bun

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

TypeError: Attempted to assign to readonly property. #11754

Closed mrceperka closed 2 days ago

mrceperka commented 4 months ago

What version of Bun is running?

1.1.12+43f0913c3

What platform is your computer?

Linux 6.8.11-300.fc40.x86_64 x86_64 unknown

What steps can reproduce the bug?

// src/main.ts
import puppeteer from 'puppeteer-extra'
import stealth from 'puppeteer-extra-plugin-stealth'

puppeteer.use(stealth())
await puppeteer.launch(/* does not really matter */)
bun build --compile --target=bun-linux-x64 ./src/main.ts --outfile main
./main
82525 | 
82526 | // node_modules/clone-deep/utils.js
82527 | var require_utils6 = __commonJS((exports, module) => {
82528 |   var utils = require_lazy_cache()(import.meta.require);
82529 |   var fn = import.meta.require;
82530 |   import.meta.require = utils;
          ^
TypeError: Attempted to assign to readonly property.
      at /$bunfs/root/main:82530:3
      at /$bunfs/root/main:18:75
      at /$bunfs/root/main:82572:15
      at /$bunfs/root/main:18:75
      at /$bunfs/root/main:82724:15
      at /$bunfs/root/main:18:75
      at /$bunfs/root/main:82755:16
      at /$bunfs/root/main:18:75
      at /$bunfs/root/main:82892:34
      at /$bunfs/root/main:18:75

What is the expected behavior?

It should work

What do you see instead?

TypeError: Attempted to assign to readonly property

Additional information

Bun v1.1.12 (Linux x64)

Jarred-Sumner commented 2 months ago

Confirming this still occurs as of Bun v1.1.22

The bug is caused by a library attempting to reassign import.meta.require

wimil commented 2 days ago

I have the same problem, any solution?