Skip to content

Babel Plugin to transform nested subpackage default imports to non-nested member imports

License

Notifications You must be signed in to change notification settings

andre-meyer/babel-plugin-transform-default-export

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-transform-default-import

This plugin transforms nested subpackage import into member-style imports that are not nested. Here's an example:

import Box from '@material-ui/core/Box';
import Modal from '@material-ui/core/Modal';
import Divider from '@material-ui/core/Divider';
import Something from '@material-ui/core/ADifferentName';

into

import { Box } from '@material-ui/core';
import { Modal } from '@material-ui/core';
import { Divider } from '@material-ui/core';
import { ADifferentName as Something } from '@material-ui/core';

Why?

I developed this project to use @material-ui/core as an external dependency in a project that used AMD, because without this plugin, it would create many dependencies that would require @material-ui/core/Box, @material-ui/core/Modal, etc. There were webpack configurations that make this possible, but not for AMD libraries.

Tests

run npm t to see it validate against the snapshots in __tests__/__snapshots__/

Notes

Too lazy to put this on npm. Good luck.

About

Babel Plugin to transform nested subpackage default imports to non-nested member imports

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published