Skip to content

ESbuild loader Plugin: Dynamic Imports do not contain "with" information #3797

@tiagomta

Description

@tiagomta

Hi,

I've noticed when using a custom plugin for esbuild dynamic imports behave differently from static imports, not sure if this is per design or a bug, so posting here.
I was expecting this two lines of code to behave the same

import env from "./env.txt" with { type: "env" }; // uses the .env instead of txt
const env2 = (await import("./env.txt", { with: { type: "env" }, }))?.default; // Uses the default for txt which is text
I've checked and the On-load arguments comes has: [Arguments] { '0': { path: '***', namespace: 'file', suffix: '', pluginData: undefined, with: {} } }

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