Skip to content

Using inject with target=es6 -> export error #3343

Description

@Le0Developer

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 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions