Supported bundlers
Bun

Usage with Bun

Installation

# npm
npm i -D @wyw-in-js/bun
# yarn
yarn add --dev @wyw-in-js/bun
# pnpm
pnpm add -D @wyw-in-js/bun
# bun
bun add -d @wyw-in-js/bun

Configuration

Bun plugins are configured via the Bun.build() API:

import wyw from '@wyw-in-js/bun';
 
await Bun.build({
  entrypoints: ['src/index.ts'],
  outdir: 'dist',
  plugins: [
    wyw({
      filter: /\.[cm]?[jt]sx?$/,
    }),
  ],
});

Keeping CSS comments

WyW can preserve CSS comments (for example, /*rtl:ignore*/) via keepComments.

Bun currently strips CSS comments in the final extracted CSS output (including directives like /*rtl:ignore*/). Bun may keep top-level /*!...*/ license comments, but comments inside rules are dropped.

wyw({
  keepComments: true,
  // or keep only matching comments:
  // keepComments: /rtl:/,
});