1.3.2 • Published 4 years ago

babel-plugin-module-mapper v1.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

babel-plugin-module-mapper

Build Status

TODO

  • generate only one import when transform to exist import declaretion

This plugin aim to map particular import to another module.

demo

for some reason, you can't modify code, you need babel to do this

import { createElement, PropTypes } from 'react';

to

import { createElement } from 'react';
import PropTypes from 'prop-types';

config

{
    '${targetModuleName}': {
        '${targetExport (defaultExport alias to default)}': ['${targetModuleName}', '${targetExportName}', ${targetLocalName?}]
    }
}

// demo config for demo
{
    'react': {
        'PropTypes': ['prop-types', 'default']
    }
}

targetLocalName

    {
     'preact': {
         'preact': ['preact', 'default', 'React']
     }
    }

transform:

import preact from 'preact';
// will transform to:
import React from 'preact';

lis

WTF lis.

1.2.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago