Skip to content

Instantly share code, notes, and snippets.

@dmnsgn
Last active April 26, 2018 11:09
Show Gist options
  • Save dmnsgn/05e9a1805e6e126f8c3de25d7c1f97c8 to your computer and use it in GitHub Desktop.
Save dmnsgn/05e9a1805e6e126f8c3de25d7c1f97c8 to your computer and use it in GitHub Desktop.

Revisions

  1. dmnsgn revised this gist Apr 26, 2018. No changes.
  2. dmnsgn created this gist Apr 16, 2018.
    26 changes: 26 additions & 0 deletions package-name-maps.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <!DOCTYPE html>
    <html>

    <head>
    <title>ES modules in the browser - almost - now | Package name maps</title>
    </head>

    <body>
    <!-- Declare the package map -->
    <script type="packagemap">
    {
    "path_prefix": "/node_modules",
    "packages": {
    "lodash": { "path": "lodash-es", "main": "lodash.js" }
    }
    }
    </script>

    <!-- Bare import will be mapped -->
    <script type="module">
    import { clamp } from "lodash";
    // => import { partition } from "/node_modules/lodash-es/lodash.js";
    </script>
    </body>

    </html>