镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Using experimental ESM HTTPS imports inside experimental vm.Module crashes #43288

Description

@Pyrolistical

Version

18.2.0

Platform

Darwin Ronalds-iMac.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:45 PDT 2022; root:xnu-7195.141.29~1/RELEASE_X86_64 x86_64

Subsystem

vm and esm

What steps will reproduce the bug?

Within a vm module attempt an esm https import.

Run with both flags --experimental-vm-modules --experimental-network-imports

Full repo cases https://github.com/Pyrolistical/vm-modules-network-imports-crash

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

esm https imports work within vm module

What do you see instead?

crashes

node:internal/vm/module:313
        if (module[kWrap] === undefined) {
                  ^

TypeError: Cannot read properties of undefined (reading 'Symbol(kWrap)')
    at ModuleWrap.<anonymous> (node:internal/vm/module:313:19)
    at async Promise.all (index 0)
    at async SourceTextModule.<computed> (node:internal/vm/module:330:11)
    at async SourceTextModule.link (node:internal/vm/module:197:5)
    at async file:///Users/rchen/dev/projects/github.com/Pyrolistical/vm-modules-plus-network-imports/vm-module-network-imports.js:13:1

Additional information

No response

Activity

  1. Pyrolistical commented on Jun 1, 2022

    @Pyrolistical
    Author

    I see the problem. Its because my linker is returning undefined when the specifier is the https url. The vm module could offer a better error message in that case.

    It would be nice there was a default linker we could use that already implements normal esm file/https resolutions and the linker steps simply allows us to override the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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