Skip to content

crash after set process.default to any value and then firstly require or import process module #51480

Description

@LongTengDao

Version

v20.10.0

Platform

No response

Subsystem

seems loader init the esm builtin from cjs, which shown on process because only process module can be accessed before require/import.

What steps will reproduce the bug?

process.default = 1;
require('process');// crash
process.default = 1;
import('process');// crash
require('process');
process.default = 1;
require('process');// ok
import('process');// ok
process.x = 1;
import('process').then(processModule => {
    console.log('x' in processModule);// true
});

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

every time.

What is the expected behavior? Why is that the expected behavior?

don't crash. and esm version should not use the modified cjs version to init its module names, if I'm right.

What do you see instead?

crash (even not throw).

Additional information

No response

Activity

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