This uses the new StartExecutionCallbackWithModule embedder API to support ESM entrypoint in SEA via a new configuration field `"mainFormat"`. The behavior currently aligns with the embedder API and is mostly in sync with the CommonJS entry point behavior, except that support for code caching and snapshot is left for follow-ups. PR-URL: https://github.com/nodejs/node/pull/61813 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
33 lines
720 B
JavaScript
33 lines
720 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const {
|
|
buildSEA,
|
|
skipIfBuildSEAIsNotSupported,
|
|
} = require('../common/sea');
|
|
|
|
skipIfBuildSEAIsNotSupported();
|
|
|
|
// This tests the creation of a single executable application with an ESM
|
|
// entry point using the "mainFormat": "module" configuration.
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
const fixtures = require('../common/fixtures');
|
|
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
|
|
|
|
tmpdir.refresh();
|
|
|
|
const outputFile = buildSEA(fixtures.path('sea', 'esm'));
|
|
|
|
spawnSyncAndExitWithoutError(
|
|
outputFile,
|
|
{
|
|
env: {
|
|
NODE_DEBUG_NATIVE: 'SEA',
|
|
...process.env,
|
|
},
|
|
},
|
|
{
|
|
stdout: /ESM SEA executed successfully/,
|
|
});
|