
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
babel-plugin-transform-import-css
Advanced tools
Injects class map imported from css-modules into js.
Plugin respects webpack css-modules API and postcss config.
npm add -SD babel-plugin-transform-import-css
.babelrc example:
{
"sourceMaps": "inline",
"presets": [
"@babel/env",
"react"
],
"plugins": [
["transform-import-css", {
"generateScopedName": "lib-[name]-[local]-[hash:base64:4]"
}]
]
}
Every js file that has a statement such as:
import classes from './Component.css'
// ... some code
will be transpiled to:
var classes = {
root: 'lib-foo-root-SFs0',
// ... some classes ...
}
require('load-styles')('.root{color:red}; ...some css...') // puts styles into the head
// ... some code
generateScopedName — css-modules scope template. Default: [name]__[local]___[hash:base64:5]configPath — postcss config path. Default: auto detectext — postcss files' extension. Typical use: ext: '.pcss'. Default: '.css'Note. Plugin rely on some @babel/ peerDependencies, that are typically included in your project by @babel/core self.
Bundling the css with npm packed library of js/react components. It is good for portability.
configPath and ext optionsrequire('load-styles')(css) inserting in that cases.postcss-load-config lib can't be used due to synchronous nature of the babel).export { classes } friendlyimport jssObject from './style.css')
Russian Fintech startup
FAQs
Injects imported styles (css-modules) into js
We found that babel-plugin-transform-import-css 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
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.