@estack/import-folder
v0.2.0
Published
dev-server to create applications, sites or prototypes using only JS, HTML and CSS, No transpilation.
Downloads
7
Readme
@estack/import-folder
Associates a search path according to an export object based on format [node.js/packages_exports][https://nodejs.org/api/packages.html#packages_exports].
Objective
Utility to resolve relative paths to the package name
Usage
import { importFolder } from "@estack/import-folder";
const pkg = {
exports: {
".": "core.js",
"./age/maps/*": "./age/custom/*.js",
"./html": "./src/quote.js",
},
};
importFolder(pkg.exports, "age/map/demo"); // "./age/custom/demo.js"
importFolder(pkg.exports, ""); // "./core.js"
importFolder(pkg.exports, "html"); // "./src/quote.js"
importFolder(pkg.exports, "not-found"); // false