# @stylable/esbuild

> Stylable plugin for esbuild

Latest version **6.1.1** (published 2024-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stylable/esbuild
pnpm add @stylable/esbuild
yarn add @stylable/esbuild
bun add @stylable/esbuild
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.1.1 |
| Published | 2024-05-30 |
| First published | 2023-05-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.12.0 |
| Dependencies | 8 |
| Unpacked size | 85.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1274 |
| Author | Wix.com |
| Maintainers | tomrav, avi.vahl, idoros, baraki, cijoe, alexswix |
| Keywords | esbuild-plugin, Stylable |

## Links

- npm: https://www.npmjs.com/package/@stylable/esbuild
- Repository: https://github.com/wix/stylable.git#master
- Homepage: https://github.com/wix/stylable/tree/master#readme
- Issues: https://github.com/wix/stylable/issues
- npm.io page: https://npm.io/package/@stylable/esbuild

## Dependencies (8)

- [decache](https://npm.io/package/decache.md) ^4.6.2
- [@stylable/cli](https://npm.io/package/@stylable/cli.md) ^6.1.1
- [@stylable/core](https://npm.io/package/@stylable/core.md) ^6.1.1
- [@stylable/node](https://npm.io/package/@stylable/node.md) ^6.1.1
- [@stylable/runtime](https://npm.io/package/@stylable/runtime.md) ^6.1.1
- [@file-services/node](https://npm.io/package/@file-services/node.md) ^9.3.0
- [@stylable/optimizer](https://npm.io/package/@stylable/optimizer.md) ^6.1.1
- [@stylable/build-tools](https://npm.io/package/@stylable/build-tools.md) ^6.1.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 6.1.1 (latest) — 2024-05-30
- 5.19.0 (release-5.x) — 2024-03-05
- 6.0.0-rc.3 (next) — 2024-02-01
- 6.1.0 — 2024-05-21
- 6.0.2 — 2024-04-15
- 6.0.1 — 2024-03-19
- 6.0.0 — 2024-03-13
- 5.18.1 — 2024-02-12
- 5.18.0 — 2024-01-14
- 5.17.0 — 2023-12-03
- 6.0.0-rc.2 — 2023-11-08
- 6.0.0-rc.1 — 2023-11-08
- 5.16.1 — 2023-10-05
- 5.16.0 — 2023-09-14
- 5.15.2 — 2023-09-11
- … 8 more at https://npm.io/package/@stylable/esbuild/versions

## README

# @stylable/esbuild

[![npm version](https://img.shields.io/npm/v/@stylable/esbuild.svg)](https://www.npmjs.com/package/@stylable/esbuild)

`@stylable/esbuild` 

## Installation

```bash
npm install @stylable/esbuild
```

## Usage

```js
const { build } = require('esbuild');
const { stylablePlugin } = require('@stylable/esbuild');

build({
  plugins: [stylablePlugin({ /* options */})],
});

```

## Options

```ts
interface ESBuildOptions {
    /**
     * Determine the way css is injected to the document
     * js - every js module contains the css and inject it independently
     * css - emit bundled css asset to injected via link
     */
    cssInjection?: 'js' | 'css';
    /**
     * Config how error and warning reported to esbuild by stylable
     * auto - Stylable warning will emit esbuild warning and Stylable error will emit esbuild error
     * strict - Stylable error and warning will emit esbuild error
     * loose - Stylable error and warning will emit esbuild warning
     */
    diagnosticsMode?: DiagnosticsMode;
    /**
     * A function to override Stylable instance default configuration options
     */
    stylableConfig?: (config: StylableConfig, build: PluginBuild) => StylableConfig;
    /**
     * Use to load stylable config file.
     * true - it will automatically detect the closest "stylable.config.js" file and use it.
     * false - will not load any "stylable.config.js" file.
     * string - will use the provided string as the "configFile" file path.
     */
    configFile?: boolean | string;
    /**
     * Stylable build mode
     */
    mode?: 'production' | 'development';
    /**
     * Determine the runtime stylesheet id kind used by the cssInjection js mode
     * This sets the value of the st_id attribute on the stylesheet element
     * default for dev - 'module+namespace'
     * default for prod - 'namespace'
     */
    runtimeStylesheetId?: 'module' | 'namespace' | 'module+namespace';
    /**
     * Optimization options
     */
    optimize?: {
        removeUnusedComponents?: boolean;
    };
}
```


## License
Copyright (c) 2023 Wix.com Ltd. All Rights Reserved. Use of this source code is governed by an [MIT license](./LICENSE).

---
_Source: https://npm.io/package/@stylable/esbuild · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
