jsenv / importmap-node-module

Generate importmap for node_modules
33 stars 4 forks source link

Inline html #72

Closed dmail closed 10 months ago

dmail commented 10 months ago

Fixes https://github.com/jsenv/importmap-node-module/issues/68

Changelog

This pull request allow the following:

Command to generate importmap into an html file:

npm @jsenv/importmap-node-module index.html --remove-unused

API to generate importmap for an html file:

import { writeImportmaps } from "@jsenv/importmap-node-module";

await writeImportmaps({
  projectDirectoryUrl: new URL("./", import.meta.url),
  importmaps: {
    "./index.html": {
      mappingsForNodeResolution: true,
      removeUnused: true,
    },
  },
});