-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
Description
Describe the bug
3677afe introduced a top-level await in lib/util/browser.js
which prevents the library from being bundled with esbuild when previously it was fine.
To reproduce
Steps to reproduce the behavior:
- In a new directory, run
npm install -S @novnc/novnc esbuild
- Create an
index.js
withimport RFB from "@novnc/novnc";
- Attempt to bundle the file with
npx esbuild index.js --bundle
- See errors like the following:
✘ [ERROR] This require call is not allowed because the imported file "node_modules/@novnc/novnc/lib/util/browser.js" contains a top-level await node_modules/@novnc/novnc/lib/rfb.js:11:23: 11 │ var _browser = require("./util/browser.js"); ╵ ~~~~~~~~~~~~~~~~~~~ The top-level await in "node_modules/@novnc/novnc/lib/util/browser.js" is here: node_modules/@novnc/novnc/lib/util/browser.js:179:68: 179 │ exports.supportsWebCodecsH264Decode = supportsWebCodecsH264Decode = await _checkWebCodecsH264DecodeSupport(); ╵ ~~~~~
Expected behavior
The file bundles successfully.
Server (please complete the following information):
- noVNC version: 1.6.0
- esbuild version: 0.25.1
- Node version: v20.9.0
- OS: macOS 15.3.1
Additional context
This happens even when using esbuild's default target of esnext
. Is it possible to compile a version of browser.js
that does not use a top-level await?
naggie, clowder, unode, SteveW94, romanslonov and 22 more