
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@stylexjs/webpack-plugin
Advanced tools
Install the package by using:
npm install --save-dev @stylexjs/webpack-plugin
or with yarn:
yarn add --dev @stylexjs/webpack-plugin
Add the following to your webpack.config.js
const StylexPlugin = require('@stylexjs/webpack-plugin');
const path = require('path');
const config = (env, argv) => ({
entry: {
main: './src/index.js',
},
output: {
path: path.resolve(__dirname, '.build'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
plugins: [
// Ensure that the stylex plugin is used before Babel
new StylexPlugin({
filename: 'styles.[contenthash].css',
// get webpack mode and set value for dev
dev: argv.mode === 'development',
// Use statically generated CSS files and not runtime injected CSS.
// Even in development.
runtimeInjection: false,
// optional. default: 'x'
classNamePrefix: 'x',
// Required for CSS variable support
unstable_moduleResolution: {
// type: 'commonJS' | 'haste'
// default: 'commonJS'
type: 'commonJS',
// The absolute path to the root directory of your project
rootDir: __dirname,
},
}),
],
cache: true,
});
module.exports = config;
It inherits all options from @stylexjs/babel-plugin and can be found here 🔗. Along with other options like
fileName: string // Default: 'stylex.css'
The name of the output css file.
useCSSLayers: boolean // Default: false
Enabling this option switches Stylex from using :not(#\#) to using @layers for handling CSS specificity.
babelConfig: {
babelrc: boolean,
plugins: PluginItem[],
presets: PluginItem[]
} // Default: { babelrc: false, plugins: [], presets: [] }
List of custom babel plugins and presets which can be used during code transformation and whether to use the .babelrc file.
FAQs
Webpack plugin for StyleX
The npm package @stylexjs/webpack-plugin receives a total of 1,182 weekly downloads. As such, @stylexjs/webpack-plugin popularity was classified as popular.
We found that @stylexjs/webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.