
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
babel-plugin-named-asset-import
Advanced tools
Babel plugin for named asset imports in Create React App
The babel-plugin-named-asset-import package is a Babel plugin that allows you to transform certain import statements with a specific naming convention into a different form. This is particularly useful when working with asset files like images, stylesheets, and other static files in a JavaScript or TypeScript project. It can help with customizing the way assets are imported and processed during the build process.
Transforming asset imports
This feature allows you to import an asset, such as an SVG file, in two different forms: as a URL and as a React component. The plugin will transform the import statement so that you can use the asset both as a source for an image tag and as a component in your JSX.
import logoUrl, { ReactComponent as Logo } from './logo.svg';
This package provides similar functionality to babel-plugin-named-asset-import by allowing you to transform import statements for assets into a specified format. It can be configured to return a custom string or a JavaScript object based on the asset's filename, which can be useful for including assets in your bundle.
babel-plugin-inline-import allows you to import text files like GraphQL queries, CSS, or HTML as strings directly into your JavaScript code. This is somewhat similar to babel-plugin-named-asset-import, but instead of transforming the import statement, it inlines the content of the imported file.
While not specifically for assets, babel-plugin-import is designed to modify import statements in a way that can help with tree shaking and reducing bundle sizes. It can be used to import components from libraries in a more granular way, which is a different approach compared to handling static assets but still relates to import statement transformation.
FAQs
Babel plugin for named asset imports in Create React App
The npm package babel-plugin-named-asset-import receives a total of 2,584,991 weekly downloads. As such, babel-plugin-named-asset-import popularity was classified as popular.
We found that babel-plugin-named-asset-import demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.