温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/vm/constants
点击访问原文链接

Node vm.constants object | API Reference | Bun

Node vm.constants object | API Reference | BunBuildDocsReferenceGuidesBlogDiscord/node:vm/constantsVDONT_CONTEXTIFYVUSE_MAIN_CONTEXT_DEFAULT_LOADER

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:vm/constantsVDONT_CONTEXTIFYVUSE_MAIN_CONTEXT_DEFAULT_LOADER

namespace

vm.constantsnamespace constants

Returns an object containing commonly used constants for VM operations.

const DONT_CONTEXTIFY: number

This constant, when used as the contextObject argument in vm APIs, instructs Node.js to create a context without wrapping its global object with another object in a Node.js-specific manner. As a result, the globalThis value inside the new context would behave more closely to an ordinary one.

When vm.constants.DONT_CONTEXTIFY is used as the contextObject argument to createContext, the returned object is a proxy-like object to the global object in the newly created context with fewer Node.js-specific quirks. It is reference equal to the globalThis value in the new context, can be modified from outside the context, and can be used to access built-ins in the new context directly.

const USE_MAIN_CONTEXT_DEFAULT_LOADER: number

A constant that can be used as the importModuleDynamically option to vm.Script and vm.compileFunction() so that Node.js uses the default ESM loader from the main context to load the requested module.

For detailed information, see Support of dynamic import() in compilation APIs.

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

Node vm.constants object | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    Returns an object containing commonly used constants for VM operations.