require.extensions[] doesn't handle for ESM modules.
This will enable trying to find additional extensions like as CJS.
Change-Id: Ie0744c16581afa829be344a07961fe7dd751b8e3
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
module._compile(content, file_path);
}
};
- require.extensions['.js.spm'] = extensionResolver;
- require.extensions['.spm'] = extensionResolver;
+ const Module = require('module');
+ Module._extensions['.js.spm'] = extensionResolver;
+ Module._extensions['.spm'] = extensionResolver;
+ if (Module.enableEsmResolveExtensions) {
+ Module.enableEsmResolveExtensions(true);
+ }
}
}