-
|
In https://github.com/rchain/rchat/pull/9/files#r772716689 , @tgrospic reports that he tried... const r = c.evaluate(`
import { config } from 'dotenv';
config();
`);but got: This is somewhat unsurprising, but... then what? I suppose the answer is to use the compartment mapper somehow, but I'm puzzled as to exactly how. Would you please
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Thank you for this amazing project! I get the same error when I try to evaluate a module with an import. A running example or simple test would be super helpful. |
Beta Was this translation helpful? Give feedback.
-
|
@tgrecojs and @ClemensLey Please pardon the long wait for my answer! The
For import behavior that resembles Node.js, you would use But, even that is a little too low-level, because SES censors any program that looks like it might have an For evasive transforms, you need
We are working on a CLI that would make this all much more striahgtforward:
|
Beta Was this translation helpful? Give feedback.
-
|
a simple example that doesn't try to emulate all of node.js would still be useful. For example, an |
Beta Was this translation helpful? Give feedback.
-
|
ah... https://github.com/endojs/endo/blob/master/packages/ses/test/test-import.js seems to have the relevant stuff. |
Beta Was this translation helpful? Give feedback.
@tgrecojs and @ClemensLey Please pardon the long wait for my answer!
The
Compartmenthas animport(specifier)method, but for that to be useful, you need to create aCompartmentwith an appropriateimportHookandresolveHook. But, those are very, very low-level and have no opinions about Node.js versus Web style import semantics. Regardless, that looks like:For import behavior that resembles Node.js, you would use
@endo/compartment-mapper, which configures aCompartmentfor every package in an application, looking in all the places Node.j…