
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
react-fontawesome-svg-icon
Advanced tools
This package exists to let bundle size be smaller. This is not an official package. If you are looking for an official one, please, check here: @fortawesome/react-fontawesome
I regularly need Font Awesome SVG icon to be used in personal projects. Unfortunately, existing @fortawesome/react-fontawesome brings the whole @fortawesome/fontawesome-svg-core into my bundles. It seems to happen because of the way @fortawesome/fontawesome-svg-core package bundled - tree shaking cannot remove all unused code from it.
The package uses icon vector data provided by Fontawesome SVG packages (e.g. @fortawesome/free-solid-svg-icons
or @fortawesome/free-regular-svg-icons
)
and styles from @fortawesome/fontawesome-svg-core
.
It is important to include styles from @fortawesome/fontawesome-svg-core
to the bundle to make it work.
Check installation section to more details.
import React from 'react';
import { FontAwesomeSvgIcon } from 'react-fontawesome-svg-icon';
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
const App = () => (
<FontAwesomeSvgIcon icon={faCoffee} />
);
export default App;
Resulting HTML
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 640 512" class="svg-inline--fa fa-coffee fa-w-20 fa-lg">
<path fill="currentColor" d="M192 384h192c53 0 96-43 96-96h32c70.6 0 128-57.4 128-128S582.6 32 512 32H120c-13.3 0-24 10.7-24 24v232c0 53 43 96 96 96zM512 96c35.3 0 64 28.7 64 64s-28.7 64-64 64h-32V96h32zm47.7 384H48.3c-47.6 0-61-64-36-64h583.3c25 0 11.8 64-35.9 64z">
</path>
</svg>
Install react-fontawesome-svg-icon
, @fortawesome/fontawesome-svg-core
and required SVG icon packages.
npm install --save react-fontawesome-svg-icon @fortawesome/fontawesome-svg-core @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
yarn add react-fontawesome-svg-icon @fortawesome/fontawesome-svg-core @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons
Import @fortawesome/fontawesome-svg-core/styles.css
into the entry point.
import React from 'react';
import ReactDOM from 'react-dom';
import '@fortawesome/fontawesome-svg-core/styles.css';
import App from './components/App';
ReactDOM.render(<App />, document.getElementById('root'));
className
, style
and color
props.React.forwardRef
. The ref passed to the root SVG element.Not supported yet:
transform
property: Power Transformsmask
property: Masking IconsA simple React application with react-fontawesome-svg-icon
bundle compared to a similar application with @fortawesome/react-fontawesome
bundle.
Baseline:
Comparison:
Module | Count | Size | |
---|---|---|---|
+ | ../../../../react-fontawesome-svg-icon/lib/index.esm.js | 1 | +1,574 |
+ | css ../../../../../node_modules/css-loader/dist/cjs.js!../../../../../node_modules/@fortawesome/fontawesome-svg-core/styles.css | 1 | +7,891 |
- | ../../../../../node_modules/@fortawesome/react-fontawesome/index.es.js | 5 | -91,949 |
- | ../../../../../node_modules/@fortawesome/fontawesome-svg-core/index.es.js | 1 | -76,794 |
- | ../../../../../node_modules/prop-types/index.js | 3 | -2,663 |
- | webpack/runtime/compat get default export | 1 | -267 |
- | webpack/runtime/define property getters | 1 | -308 |
- | webpack/runtime/global | 1 | -221 |
- | webpack/runtime/hasOwnProperty shorthand | 1 | -88 |
△ | 1 modules with minor changes | +58 |
FAQs
A minimal React component for Fontawesome SVG icon.
The npm package react-fontawesome-svg-icon receives a total of 2,796 weekly downloads. As such, react-fontawesome-svg-icon popularity was classified as popular.
We found that react-fontawesome-svg-icon 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.