Sitelet https://github.com/nodejs/node/issues/55869
Skip to content

[v18.20.5 / next v20.x LTS version] NodeJS should provide some kind of warning when using import assertions as they are non-standard #55869

Description

@alexsch01

Clarification

v18.20.4 (previous v18.x release) and v20.18.0 have a warning for both import assertions and import attributes

v18.20.5 removes this warning for both cases, I believe the import assertion warning should still be around

Seems to be caused by #55333

Version

v18.20.5

Platform

All

Subsystem

No response

What steps will reproduce the bug?

node --input-type=module -e 'import "data:application/json,{}" assert { type: "json" }'

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

Every time

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

Regarding [What steps will reproduce the bug?]

It should provide some kind of warning since import assertions (not import attributes) are non-standard

Additional information

This also applies to the next v20.x LTS version

Activity

  1. changed the title [-][v18.20.5] NodeJS should provide some kind of warning when using import assertions as they are non-standard[/-] [+][v18.20.5 / future v20.x LTS version] NodeJS should provide some kind of warning when using import assertions as they are non-standard[/+] on Nov 15, 2024
  2. changed the title [-][v18.20.5 / future v20.x LTS version] NodeJS should provide some kind of warning when using import assertions as they are non-standard[/-] [+][v18.20.5 / next v20.x LTS version] NodeJS should provide some kind of warning when using import assertions as they are non-standard[/+] on Nov 15, 2024
  3. avivkeller commented on Nov 15, 2024

    @avivkeller
    Member

    Adding a warning is a breaking change, and LTS lines are meant to be non-breaking.

  4. alexsch01 commented on Nov 15, 2024

    @alexsch01
    ContributorAuthor

    @redyetidev I should have clarified

    v18.20.4 (previous v18.x release) and v20.18.0 have a warning for both import assertions and import attributes

    v18.20.5 removes this warning for both cases, I believe the import assertion warning should still be around

  5. avivkeller commented on Nov 15, 2024

    @avivkeller
    Member

    Oh, okay. The removal / addition of a warning is typically semver major, I wonder why it was backported.

  6. alexsch01 commented on Nov 15, 2024

    @alexsch01
    ContributorAuthor

    This is probably the cause #55333

  7. avivkeller commented on Nov 15, 2024

    @avivkeller
    Member

    Yes, likely.

  8. nicolo-ribaudo commented on Nov 15, 2024

    @nicolo-ribaudo
    Contributor

    This is a bit difficult to fix, because V8 doesn't tell us which syntax is being used. Does any of the maintainers have any suggestion?

  9. aduh95 commented on Nov 15, 2024

    @aduh95
    Contributor

    We need to reconsider #51631

  10. alexsch01 commented on Nov 15, 2024

    @alexsch01
    ContributorAuthor

    @aduh95 thanks for the PR, just letting you know that a v20.x version will be needed

  11. aduh95 commented on Nov 16, 2024

    @aduh95
    Contributor

    @alexsch01 I'm not sure why you ping me to repeat an information that's already in the OP. If you need a 20.x backport, make the PR yourself, or pay someone to do it for you (you can find support links in the README).

  12. alexsch01 commented on Nov 16, 2024

    @alexsch01
    ContributorAuthor

    my apologies

  13. alexsch01 commented on Feb 12, 2025

    @alexsch01
    ContributorAuthor

    Fixed in v20.18.3 thank you aduh95!

    [data.json]

    {"abc":"def"}

    [script_with.mjs]

    import data from './data.json' with {type: 'json'}
    
    console.log(process.version)
    console.log(data)

    running in node

    v20.18.3
    { abc: 'def' }

    [script_assert.mjs]

    import data from './data.json' assert {type: 'json'}
    
    console.log(process.version)
    console.log(data)

    running in node

    (node:1092) V8: file:///somelocation/script_assert.mjs:1 'assert' is deprecated in import statements and support will be removed in a future version; use 'with' instead
    (Use `node --trace-warnings ...` to show where the warning was created)
    v20.18.3
    { abc: 'def' }
  14. alexsch01 commented on Feb 21, 2025

    @alexsch01
    ContributorAuthor

    Fixed in v18.20.7 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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