Skip to content

How to use CommonJS modules in Compartment? #1789

Answered by kriskowal
GulgDev asked this question in Q&A
Discussion options

You must be logged in to vote

As you have likely noticed, the Compartment API is very generic. The Compartment Mapper is one of many possible ways to bind compartments to specific module systems, specifically an approximation of Node.js that supports both CommonJS and ESM, in a style that is consistent with the needs of bundlers. The yet higher level @endo/bundle-source and @endo/import-bundle packages provide a specific zip-file based bundler that Agoric uses for contracts. The compartment mapper also has a bundle.js based on Compartment that is suitable for boot-strapping a script bundle (but not suitable for confinement). There are secure bundlers in the community based on Hardened JavaScript compartments: @naugtur

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@naugtur
Comment options

@kriskowal
Comment options

Answer selected by GulgDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1788 on September 24, 2023 01:11.