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

SyntheticModule.setExport method | Node.js vm module | Bun

SyntheticModule.setExport method | Node.js vm module | BunBuildDocsReferenceGuidesBlogDiscord/node:vm/SyntheticModule/setExportMsetExport

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:vm/SyntheticModule/setExportMsetExport

method

vm.SyntheticModule.setExport { m.setExport('x', 1); }); await m.evaluate(); assert.strictEqual(m.namespace.x, 1); ```" data-algolia-static="false" data-algolia-merged="false" data-type="Method">setExport(name: string,value: any): void;

This method sets the module export binding slots with the given value.

import vm from 'node:vm';

const m = new vm.SyntheticModule(['x'], () => {
m.setExport('x', 1);
});

await m.evaluate();

assert.strictEqual(m.namespace.x, 1);
@param name

Name of the export to set.

@param value

The value to set the export to.

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 →

SyntheticModule.setExport method | Node.js vm module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method node:vm.SyntheticModule.setExport | Bun