0.3.3 • Published 1 year ago

miniapp-compile-config v0.3.3

Weekly downloads
122
License
BSD-3-Clause
Repository
github
Last release
1 year ago

miniapp-runtime-config

小程序运行时工程公共配置设置。

参数

参数类型默认值必填描述
configobject-✔️webpack chain config
userConfigobject{}当前小程序平台的用户配置,例如 { nativeConfig: { appId: 123 } }
optionsobject-✔️options 子项见下表

options 子项

参数类型默认值必填描述
contextobject-✔️build plugin 上下文变量,包含运行时的各种环境信息
targetstring-✔️构建的小程序平台类型,例如 miniapp/wechat-miniprogram
babelRuleNamestringbabelwebpack chain config 中设置的 babel-loader 规则别名,例如 config.rule('jsx').use('babel').loader(require.resolve('babel-loader')),此时 babelRuleName 值为 babel

使用

const { setConfig } = require('miniapp-runtime-config');

setConfig(config, userConfig, { context, target, babelRuleName });