Skip to content

@swc-node/register/esm doesn't recognize .ts file #710

Description

@Phryxia

Reproduction Procedure

  1. Clone this
  2. yarn
  3. yarn dev

.swcrc

{
  "jsc": {
    "baseUrl": ".",
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "dynamicImport": true
    },
    "target": "es5"
  },
  "module": {
    "type": "es6"
  }
}

Symptoms

yarn run v1.22.19
$ SWCRC=true node --loader @swc-node/register/esm index.ts
(node:19817) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

[Error: ENOENT: no such file or directory, open '/home/sekyu-kwon/temp/index.ts.mjs'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/my-name/temp/index.ts.mjs'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

As you can see, it doesn't recognize .ts. Also same with .mts.

Is it related to .swcrc recognition issues like #701 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions