
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
babel-plugin-no-index-imports
Advanced tools
This plugin can transform index imports into direct file imports.
This plugin can transform index imports into direct file imports.
For example, the plugin can transform imports such as
import { Homepage } from '@components';
Into either default style or named imports targeting a specific file.
import { Homepage } from '@components/Homepage';
This can/will improve tree-shaking and reduce bundle size.
yarn add -D babel-plugin-no-index-imports
Add following config in your .babelrc
{
"plugins": [
["babel-plugin-no-index-imports", {
"extensions": ["js", "jsx", "ts", "tsx"],
"useDefaultImport": false,
"stripFileExtension": true,
"extractName": function(filename) {
return filename.substr(0, filename.lastIndexOf('.'));
},
"selectImport": function(importName, imports, member) {
return imports[0];
},
"prefixes": {
"@components": "./src/workspaces",
"@utils": "./src/utils"
}
}]
]
}
v1.1.0
extractName
functionFAQs
This plugin can transform index imports into direct file imports.
We found that babel-plugin-no-index-imports demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.