Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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,532,460 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.