1.1.4 • Published 6 days ago

specifier-resolution-node v1.1.4

Weekly downloads
-
License
LGPL 2.1
Repository
github
Last release
6 days ago

Goal:

  • This package intends to help experimental-specifier-resolution=node users migrate from Node.js v18 to Node.js v20 without any code change.

    • Node.js v18 node --experimental-specifier-resolution=node
    • Node.js v20 node --import=specifier-resolution-node/register
  • This package is based on the extensionless project project, but use import-meta-resolve algorithm to get closer to the behavior of node.js 18 with --experimental-loader=specifier-resolution-node

Install:

npm i specifier-resolution-node

Start node with one of the following flags added. If you're running on a version of node older than 20.6.0, use:

--experimental-loader=specifier-resolution-node

or else, use the newer one instead:

--import=specifier-resolution-node/register

You can now use import specifiers as file paths without extensions or as directory paths.

Customize:

By default specifier-resolution-node will try to append the following extensions: ['js', 'cjs', 'mjs', 'json', 'node', 'wasm']

You can customize this behavior by setting the environment variable KNOWN_EXTS this way:

KNOWN_EXTS=js,ts,tsc node --import=specifier-resolution-node/register index.js

Debug:

If you want to check why an import is not working you can set SPECIFIER_RESOLUTION_NODE_DEBUG=true environement variable

1.1.4

6 days ago

1.1.3

6 days ago

1.1.2

6 days ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.0.1

5 months ago