# taro-define-config

> Provide a defineConfig function for tarojs config

Latest version **0.15.1** (published 2026-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install taro-define-config
pnpm add taro-define-config
yarn add taro-define-config
bun add taro-define-config
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.15.1 |
| Published | 2026-08-07 |
| First published | 2022-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 11 |
| Unpacked size | 225.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | ntnyq |
| Maintainers | ntnyq |
| Keywords | config, define-config, taro, taro-plugin, tarojs, typescript |

## Links

- npm: https://www.npmjs.com/package/taro-define-config
- Repository: ntnyq/taro-define-config
- Homepage: https://github.com/ntnyq/taro-define-config#readme
- Issues: https://github.com/ntnyq/taro-define-config/issues
- npm.io page: https://npm.io/package/taro-define-config

## Dependencies (11)

- [vite](https://npm.io/package/vite.md) ^8.2.1
- [rollup](https://npm.io/package/rollup.md) ^4.62.4
- [tapable](https://npm.io/package/tapable.md) ^2.3.3
- [webpack](https://npm.io/package/webpack.md) ^5.109.2
- [@swc/types](https://npm.io/package/@swc/types.md) ^0.1.28
- [@sass/types](https://npm.io/package/@sass/types.md) ^1.102.0
- [@types/node](https://npm.io/package/@types/node.md) ^26.1.2
- [webpack-chain](https://npm.io/package/webpack-chain.md) ^6.5.1
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) ^6.0.0
- [@jridgewell/source-map](https://npm.io/package/@jridgewell/source-map.md) ^0.3.11
- [@types/html-minifier-terser](https://npm.io/package/@types/html-minifier-terser.md) ^7.0.2

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.15.1 (latest) — 2026-08-07
- 0.15.0 — 2026-06-27
- 0.14.2 — 2026-03-29
- 0.14.1 — 2026-02-23
- 0.14.0 — 2025-11-19
- 0.13.0 — 2025-08-21
- 0.12.0 — 2025-07-20
- 0.11.0 — 2025-06-04
- 0.10.8 — 2025-05-19
- 0.10.7 — 2025-05-07
- 0.10.6 — 2025-04-22
- 0.10.5 — 2025-03-01
- 0.10.4 — 2025-02-13
- 0.10.3 — 2025-01-08
- 0.10.2 — 2024-12-04
- … 37 more at https://npm.io/package/taro-define-config/versions

## README

# taro-define-config

> Provide a defineConfig function for tarojs config

[![CI](https://github.com/ntnyq/taro-define-config/workflows/CI/badge.svg)](https://github.com/ntnyq/taro-define-config/actions)
[![NPM VERSION](https://img.shields.io/npm/v/taro-define-config.svg)](https://www.npmjs.com/package/taro-define-config)
[![NPM DOWNLOADS](https://img.shields.io/npm/dy/taro-define-config.svg)](https://www.npmjs.com/package/taro-define-config)
[![LICENSE](https://img.shields.io/github/license/ntnyq/taro-define-config.svg)](https://github.com/ntnyq/taro-define-config/blob/main/LICENSE)

> [!IMPORTANT]
> For TaroJS v3 support, please use `taro-define-config` < v0.7.0.

## Install

```shell
npm i taro-define-config -D
```

```shell
yarn add taro-define-config -D
```

```shell
pnpm add taro-define-config -D
```

## Usage

```js
// config/index.js

// @ts-check
const { defineConfig } = require('taro-define-config')

module.exports = defineConfig({
  projectName: 'hello-world',
  designWidth: 750,
})
```

```ts
// config/index.ts

import { defineConfig } from 'taro-define-config'

export default defineConfig({
  projectName: 'hello-world',
  designWidth: 750,
})
```

## Why this package

> [!NOTE]  
> Taro introduced a builtin [defineConfig](https://docs.taro.zone/docs/config/#defineconfig-%E8%BE%85%E5%8A%A9%E5%87%BD%E6%95%B0) function since v3.6.9. Maybe you don't need this package.

Improve your TaroJS project configuration experience with:

- 🍭 more fine-grained type support than built-in `defineConfig`
- 🤖 auto-suggestions
- ✅ type checking (Use // @ts-check at the first line in your config file)
- 📖 documentation
- ⚠️ deprecation warnings

## Extend plugin types

```ts
declare module 'taro-define-config' {
  export interface CustomPluginOptionsMap {
    'taro-plugin-custom': {
      enable?: boolean
    }
  }
}
```

## Prior Art

- [eslint-define-config](https://github.com/Shinigami92/eslint-define-config)

## Related link

- [Taro - Config detail](https://nervjs.github.io/taro-docs/docs/config-detail)
- [Taro docs - config-detail.md](https://github.com/NervJS/taro-docs/commits/master/docs/config-detail.md)

## License

[MIT](./LICENSE) License © 2022 to PRESENT [ntnyq](https://github.com/ntnyq)

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