Skip to content

ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language #236

@zaripych

Description

@zaripych

Bug description

When I run tsx code.ts I get following output:

➜  esm-loader-warning-repro pnpm tsx code.ts
(node:76711) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
Hello esm-loader-warning-repro!

I expected:

Hello esm-loader-warning-repro!

I've noticed that we already suppress some warnings in here

Should we suppress this type of warning as well?

Reproduction

I have "type": "module" in my package.json:

{
  "name": "esm-loader-warning-repro",
  "version": "1.0.0",
  "type": "module",
  "dependencies": {
    "tsx": "^3.12.7"
  }
}

code.ts has following content:

import pack from "./package.json";

console.log(`Hello ${pack.name}!`);

I'm using Node 18:

➜  esm-loader-warning-repro pnpm tsx --version
tsx v3.12.7
node v18.16.0

Environment

System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 24.08 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  npmPackages:
    tsx: ^3.12.7 => 3.12.7

Can you work on a fix?

  • I’m interested in opening a pull request to address this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingoutdated

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions