Skip to content

@swc-node/register@1.6.0

Compare
Choose a tag to compare
@Brooooooklyn Brooooooklyn released this 10 Feb 18:41
· 67 commits to master since this release
@swc-node/register@1.6.0
75d423f

Experimental esm support

node --loader=@swc-node/register/esm ./src/index.ts in this project

src/index.ts

import assert from 'node:assert'
import test from 'node:test'

import { supportedExtensions } from 'file-type' // pure esm project

await test('file-type should work', () => {
  assert.ok(supportedExtensions.has('jpg'))
})

tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
  }
}

package.json

{
  "type": "module"
}

output

> node --loader=@swc-node/register/esm ./src/index.ts

(node:77682) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:77682) ExperimentalWarning: The test runner is an experimental feature. This feature could change at any time
TAP version 13
# Subtest: file-type should work
ok 1 - file-type should work
  ---
  duration_ms: 0.642416
  ...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 5.702292

What's Changed

Full Changelog: https://github.com/swc-project/swc-node/compare/@swc-node/jest@1.5.9...@swc-node/register@1.6.0