1.1.12 • Published 3 months ago

esm-build-2 v1.1.12

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

esm-imports-builder

Creates a version hashed import map of all ESM modules in source folder. ESM import map

Install

  • npm install esm-build-2 -g

Create a buildconfig.json file. Example:

Minimal config:

{
    "sourcedir": "./src",
    "entryhtml": "./src/index.html",
    "modifyEntryHtml": true
}

All config options:

{
    "sourcedir": "./src",
    "outputFile": "./src/importmap.json",
    "entryhtml": "./src/index.html",
    "modifyEntryHtml": true,
    "generateOutputFile": true,
    "excludes": [
        "*/ignoredfolder/**"
    ],
    "addImports": {
        "added": "./lib/other.js"
    },
    "hashAddedImports": false,
    "addScopes": {
        "http://test": {
            "added": "http://test/some-path/version1/added.js"
        }
    }
}

Configuration specification

  • "sourcedir": the path were the source of the ESM modules can be found
  • "outputFile": the JSON file which should contain the import maps
  • "entryhtml": the HTML file which is the entry point to the application and which should contain the import maps (will replace existing import maps if placed in html head)
  • "modifyEntryHtml": true if HTML file should be modified
  • "generateOutputFile": true if the JSON import maps file should be created
  • "excludes": array of excluded folders/files
  • "addImports": additional fixed imports not found in source directory
  • "hashAddedImports": read and set hashed version for additional imports
  • "addScopes": additional/optional fixed scopes for import maps

If "excludes" is included, i should contain an array of glob patterns to exclude files/folders.

Execute import map build with:

> esm-build

Optional arguments:

-c [path to config file] (supply path to config file)
-w (watch for changes and build on demand)

With argument(s):

> esm-build -c buildconfig.json

> esm-build -w
1.1.12

3 months ago

1.1.11

3 months ago

1.1.10

3 months ago

1.1.9

3 months ago

1.1.8

3 months ago

1.1.7

3 months ago

1.1.6

3 months ago

1.1.5

3 months ago

1.1.4

3 months ago

1.1.3

3 months ago

1.1.2

3 months ago

1.1.0

3 months ago