Skip to content

Build issues with v3. TypeError: Class extends value undefined is not a constructor or null #9703

@lostpebble

Description

@lostpebble

Describe the bug

After updating to version 3 we started getting the following error in our bundle script:

account_multisig.js:48 Uncaught TypeError: Class extends value undefined is not a constructor or null
    at account_multisig.js:48:41
    at requireAccount_multisig (account_multisig.js:453:2)
    at common-index.js:34:31
    at requireCommonIndex (common-index.js:53:136)
    at requireRpc_errors (rpc_errors.js:10:24)
    at json-rpc-provider.js:20:22
    at requireJsonRpcProvider (json-rpc-provider.js:356:27)
    at index.js:9:29
    at requireProviders (index.js:12:131)
    at requireAccount (account.js:10:21)

This does not occur in v2. It does also not happen while we are in "dev" mode in v3.

It appears to be an issue with how things are being bundled in the newer version- as the new code is unable to create a specific class in a library near-api-js as it used to, and the output code does look a little strange.

Reproduction

https://github.com/lostpebble/vite-class-undefined-error

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 4.29 GB / 15.79 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 104.0.5112.81
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.54)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vite: ^3.0.8 => 3.0.8

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions