Skip to content

ERR_IMPORT_ATTRIBUTE_UNSUPPORTED should show _where_ the unsupported attribute is used #56930

Open
@nicolo-ribaudo

Description

@nicolo-ribaudo

Version

23.6.1

Platform

Darwin Nics-MacBook-Air.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:23:36 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8112 arm64

Subsystem

No response

What steps will reproduce the bug?

import "./mod.js" with { BABEL_8_BREAKING: "false" };

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

It should throw about the unsupported attribute ideally showing the code where I'm using that attribute. If not possible, it should at least show the file where it's used.

What do you see instead?

node:internal/modules/esm/assert:60
      throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED(keys[i], importAttributes[keys[i]]);
            ^

TypeError [ERR_IMPORT_ATTRIBUTE_UNSUPPORTED]: Import attribute "BABEL_8_BREAKING" with value "false" is not supported
    at validateAttributes (node:internal/modules/esm/assert:60:13)
    at defaultLoad (node:internal/modules/esm/load:129:3)
    at ModuleLoader.load (node:internal/modules/esm/loader:736:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:516:43)
    at #createModuleJob (node:internal/modules/esm/loader:540:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:309:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:277:41) {
  code: 'ERR_IMPORT_ATTRIBUTE_UNSUPPORTED'
}

It only shows internal stack frames

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions