Provide a defineConfig function for tarojs config
Important
For TaroJS v3 support, please use taro-define-config < v0.7.0.
npm i taro-define-config -Dyarn add taro-define-config -Dpnpm add taro-define-config -D// config/index.js
// @ts-check
const { defineConfig } = require('taro-define-config')
module.exports = defineConfig({
projectName: 'hello-world',
designWidth: 750,
})// config/index.ts
import { defineConfig } from 'taro-define-config'
export default defineConfig({
projectName: 'hello-world',
designWidth: 750,
})Note
Taro introduced a builtin defineConfig 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
declare module 'taro-define-config' {
export interface CustomPluginOptionsMap {
'taro-plugin-custom': {
enable?: boolean
}
}
}