Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea: allow requiring core modules with the "node:" prefix #47779

Commits on Apr 29, 2023

  1. sea: allow requiring core modules with the "node:" prefix

    Previously, the `require()` function exposed to the embedded SEA code
    was calling the internal `require()` function if the module name
    belonged to the list of public core modules but the internal `require()`
    function does not support loading modules with the "node:" prefix, so
    this change forwards the calls to another `require()` function that
    supports this.
    
    Fixes: nodejs/single-executable#69
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed Apr 29, 2023
    Configuration menu
    Copy the full SHA
    614323f View commit details
    Browse the repository at this point in the history

Commits on May 3, 2023

  1. bootstrap: fix bug in the snapshot require function and share the cod…

    …e with the SEA require
    
    Previously, this code:
    ```sh
    node --snapshot-blob snapshot.blob --build-snapshot <(echo "require('node:test')")`
    ```
    was failing with a "Error: Cannot find module 'node:test'." error, so
    this change fixes that and uses the same code path for normalizing ids
    for both the snapshot require function as well as the SEA require
    function.
    
    However, building a snapshot when `node:test` is required now fails with:
    ```sh
    ./node --snapshot-blob snapshot.blob --build-snapshot <(echo "require('node:test')")
    (node:5362) Warning: built-in module node:test is not yet supported in user snapshots
    (Use `node --trace-warnings ...` to show where the warning was created)
    Unknown external reference 0x10201dd70.
    <unresolved>
    [1]    5362 trace trap  ./node --snapshot-blob snapshot.blob --build-snapshot
    ```
    which could be solved in a separate PR.
    
    Refs: nodejs#47779 (comment)
    Signed-off-by: Darshan Sen <raisinten@gmail.com>
    RaisinTen committed May 3, 2023
    Configuration menu
    Copy the full SHA
    2d9e3c5 View commit details
    Browse the repository at this point in the history