Skip to content

WebContainer crash due to toSorted not supported (Threejs Project) #1905

@alanhertanto

Description

@alanhertanto

Describe the bug

When I clone my personal Three.js-based project repository into StackBlitz using the "Repositories (beta)" feature, the WebContainer successfully completes the cloning process. However, as soon as it attempts to start the project, it crashes.

Link to the blitz that caused the error

https://stackblitz.com/~/github.com/alanhertanto/alan-hertanto-site-threejs

Steps to reproduce

  1. Use the “Repositories (beta)” feature in StackBlitz to clone my existing project repository.
  2. Wait for the cloning process to complete.
  3. As soon as the WebContainer tries to automatically start the project, it crashes immediately with the toSorted TypeError.

Expected behavior

I expected the project to run the same way it does locally: the WebContainer should start without crashing, serve the files correctly, and display my Three.js scene in the browser with the .glb model loaded as intended.

Parity with Local

Screenshots

Image
Image
Image
Image
Image

Platform

Version = 1.84.0
Hash = 3b0b7194bc6b567c2eaf4c96a5759098469dcf59
WebContainer = 2e6e5e13

Browser name  = Chrome
Full version  = 103.0.0.0
Major version = 103
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (X11; CrOS x86_64 14816.131.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 121576322,
  "usedJSHeapSize": 102974630,
  "jsHeapSizeLimit": 2062548992
}

Additional context

TypeError: u.toSorted is not a function
at http (node:http:33:523)
at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:47:3850)
at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:47:3018)
at loadBuiltinModule (node:internal/modules/helpers:166:1312)
at Module._load (node:internal/modules/cjs/loader:148:12547)
at Module.require (node:internal/modules/cjs/loader:148:15469)
at require3 (node:internal/modules/helpers:166:2696)
at _0xd78bac (https://alanhertantositethreejs-1a3p.w-credentialless-staticblitz.com/blitz.2e6e5e13.js:31:860485)
at Object.eval (/usr/share/stackblitz/out/server-main.js:1:242)
at Object._0x45d933 (https://alanhertantositethreejs-1a3p.w-credentialless-staticblitz.com/blitz.2e6e5e13.js:31:860614)

Node.js v20.19.1

Apologies if this overlaps with another open issue — feel free to close or merge if needed.
I hope this helps improve Node API and ES feature compatibility in WebContainer!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions