⚠️ IN DEVELOPMENT: You may encounter some issues when using this plugin for production builds
bun add -d bun-plugin-stylex
Due to the current limitations of Bun
the consumer must generate and write the CSS
output manually.
import path from 'node:path';
import createStylexPlugin from 'bun-plugin-stylex';
const [stylexPlugin, generateCSS] = createStylexPlugin({
// plugin options
dev: false,
});
await Bun.build({
entrypoints: [path.resolve(__dirname, './src/index.ts')],
plugins: [stylexPlugin],
outdir: 'dist',
});
const generatedCSS = await generateCSS();
if (generatedCSS) {
await Bun.write(path.resolve(__dirname, 'dist/styles.css'), generatedCSS);
}