Skip to content

ESM: restore support for ASAR #228064

Open
Open
@bpasero

Description

@bpasero

For ESM we have disabled ASAR but we should investigate bringing it back.

We used to have this code to inject the lookup path:

module.exports.enableASARSupport = function () {
// ESM-comment-begin
// const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
// const NODE_MODULES_ASAR_PATH = `${NODE_MODULES_PATH}.asar`;
//
// // @ts-ignore
// const originalResolveLookupPaths = Module._resolveLookupPaths;
//
// // @ts-ignore
// Module._resolveLookupPaths = function (request, parent) {
// const paths = originalResolveLookupPaths(request, parent);
// if (Array.isArray(paths)) {
// for (let i = 0, len = paths.length; i < len; i++) {
// if (paths[i] === NODE_MODULES_PATH) {
// paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
// break;
// }
// }
// }
//
// return paths;
// };
// ESM-comment-end
};

But going forward, Electron should expose a way for us to enlist a path as ASAR path so that it can internally handle this as early as possible.

Metadata

Metadata

Assignees

Labels

ESMIssues caused by our AMD => ESM workconfirmedIssue has been confirmed by VS Code Team memberdebtCode quality issueselectronIssues and items related to ElectronupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions