I'm trying to use inject to shim some functions while targeting es6, but I am getting the following error due to the export { fn as name } syntax:
Using a string as a module namespace identifier name is not supported in the configured target environment ("es2015")
Playground reproduction using the process.cwd example shim from the docs. Removing target=es6 from the compiler options makes it build as expected.
I've been trying alternatives (such as export default { name: fn }, module.exports = { name: fn }) but using them causes esbuild to not use the shim. (export let name = fn does work, however the name cannot contain dots in that case).
Any advice would be appreciated 🙏
I'm trying to use
injectto shim some functions while targeting es6, but I am getting the following error due to theexport { fn as name }syntax:Using a string as a module namespace identifier name is not supported in the configured target environment ("es2015")Playground reproduction using the process.cwd example shim from the docs. Removing
target=es6from the compiler options makes it build as expected.I've been trying alternatives (such as
export default { name: fn },module.exports = { name: fn }) but using them causes esbuild to not use the shim. (export let name = fndoes work, however the name cannot contain dots in that case).Any advice would be appreciated 🙏