JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4699
  • Score
    100M100P100Q136064F
  • License LGPL 2.1

Node.js loader for import specifiers as file paths without extensions or as directory paths

Package Exports

  • specifier-resolution-node
  • specifier-resolution-node/register

Readme

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

Particulary, it supports imports: {} when it's specified in package.json


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.