babel-plugin-not-js-import-remover
v0.1.0
Published
remove import statments that are importing not-js file
Downloads
2
Readme
Babel Plugin Not-Js Import Remover
This plugin removes Not-Js Import from files.
Purpose
The original purpose is removing CSSs and images import statments from react components when trying to SSR.
Caution
You Must use this plugin before @babel/plugin-transform-modules-commonjs or plugins shuch that converting import statements to require calls, Because this module doesn't remove calling require at all. it only removes import statements that have not allowed extensions.
How to Use
Default Not Allowed Extensions
- html,
- css,
- sass,
- scss,
- less,
- stylus,
- svg,
- png,
- jpg,
- jpeg,
- gif,
Extend Not Allowed Extensions
{
plugins: [
['not-js-import-remover', { extends: ['extension1', 'extension2'] }],
];
}
{
"plugins": [
["not-js-import-remover", { "extends": ["extension1", "extension2"] }],
];
}