0.6.1 • Published 2 months ago
@stylexjs/esbuild-plugin v0.6.1
@stylexjs/esbuild-plugin
Use StyleX with esbuild bundler.
This plugin transforms files that contain stylexjs
imports and generates a
stylexjs
CSS bundle.
Installation
npm install --save-dev @stylexjs/esbuild-plugin
Usage
import esbuild from 'esbuild';
import stylexPlugin from '@stylexjs/esbuild-plugin';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
esbuild.build({
entryPoints: ['src/index.js'],
bundle: true,
outfile: './build/bundle.js',
minify: true,
plugins: [
stylexPlugin({
// If set to 'true', bundler will inject styles in-line
// Do not use in production
dev: false,
// Required. File path for the generated CSS file
generatedCSSFileName: path.resolve(__dirname, 'build/stylex.css'),
// Aliases for StyleX package imports
// default: '@stylexjs/stylex'
stylexImports: ['@stylexjs/stylex'],
// Required for CSS variable support
unstable_moduleResolution: {
// type: 'commonJS' | 'ESModules' | 'haste'
// default: 'commonJS'
type: 'commonJS',
// The absolute path to the root of your project
rootDir: __dirname,
},
}),
],
});
You can see the example usage here.
0.6.1
2 months ago
0.6.0
2 months ago
0.5.0
5 months ago
0.5.1
5 months ago
0.5.0-alpha.4
5 months ago
0.5.0-alpha.3
5 months ago
0.5.0-alpha.2
5 months ago
0.5.0-alpha.1
5 months ago