没有 require.resolve


【No require.resolve

相对解析可以通过 new URL('./local', import.meta.url) 来处理。

【Relative resolution can be handled via new URL('./local', import.meta.url).】

对于完整的 require.resolve 替代方案,可以使用 import.meta.resolve API。

【For a complete require.resolve replacement, there is the import.meta.resolve API.】

或者可以使用 module.createRequire()

【Alternatively module.createRequire() can be used.】