jsenv / importmap-node-module

Generate importmap for node_modules
35 stars 4 forks source link

Inline html #72

Closed dmail closed 11 months ago

dmail commented 11 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,
    },
  },
});