1.2.0 • Published 4 years ago

babel-plugin-mock-imports v1.2.0

Weekly downloads
970
License
MIT
Repository
github
Last release
4 years ago

Babel Plugin Mock Imports

npm version

Babel plugin for redirecting imports to a different location.

Quickstart

npm:

npm install babel-plugin-mock-imports --save-dev

yarn:

yarn add babel-plugin-mock-imports --dev

Usage

.babelrc:

{
  "plugins": [
    ["mock-imports", {
      "redirects": [
        {
          "pattern": ".(svg)$",
          "location": "path/to/mocked/react/component"
        },
        {
          "pattern": "^redux-form/es$",
          "location": "redux-form"
        }
      ]
    }]
  ]
}

babel.config.js:

module.exports = {
  plugins: [
    ['mock-imports', {
      redirects: [
        {
          pattern: '.(svg)$',
          location: 'path/to/mocked/react/component'
        },
        {
          pattern: '^redux-form/es$',
          location: 'redux-form'
        }
      ]
    }]
  ]
}

The pattern is evaluated using the RegExp constructor.

1.2.0

4 years ago

1.1.2

4 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago