JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1092
  • Score
    100M100P100Q113425F
  • License BSD-3-Clause

Babel plugin to rewrite bare imports for browser use.

Package Exports

  • babel-plugin-bare-import-rewrite

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-bare-import-rewrite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-bare-import-rewrite

Travis CI Greenkeeper badge NPM Version NPM Downloads BSD-3-Clause

Babel plugin to rewrite bare imports. In theory this will become obsolete if/when browsers get support for import maps. See domenic/package-name-maps for information about the proposal.

Install babel-plugin-bare-import-rewrite

This module requires node.js 8 or above and @babel/core.

npm i babel-plugin-bare-import-rewrite

Usage

Add bare-import-rewrite to plugins in your babel settings.

Settings

{
    "plugins": [
        ["bare-import-rewrite", {
            "modulesDir": "/node_modules"
        }]
    ]
}

modulesDir sets the web path which modules will be published from the web server. This must always be an absolute directory. Default "/node_modules".

The plugin settings object can be omitted if defaults are used:

{
    "plugins": ["bare-import-rewrite"]
}

Running tests

Tests are provided by xo and ava.

npm install
npm test

Attribution

This module is based on code found in polymer-build and polymer-analyzer.