Package Exports
- extensionless
- extensionless/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (extensionless) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Node.js loader for import specifiers as file paths without extensions or as directory paths
Install:
npm i extensionless
Start node
with the following flag added:
--experimental-loader=extensionless
You can now use import specifiers as file paths without extensions or as directory paths:
import mod from './mod'
// imports from the first existing file in the candidates list as follows
// ['./mod.js', './mod.json', './mod/index.js', './mod/index.json']
If the specifier ends with a path separator, it only looks for index files in that directory:
import mod from '../mod/'
// imports from the first existing file in the candidates list as follows
// ['../mod/index.js', '../mod/index.json']
To configure this package, you can add the field extensionless
to package.json
:
"extensionless": {
"lookFor": ["mjs", "js", "json"]
}
Field | Default Value |
---|---|
lookFor | ["js", "json"] |