@navalink/babel-plugin-collect-i18n
v1.0.3
Published
collect i18n babel plugin
Readme
Babel 插件 - 扫描代码中 i18n 标识符并收集参数
基本使用
- 安装
npm install @navalink/babel-plugin-collect-i18n -D
# or
yarn add @navalink/babel-plugin-collect-i18n -D- 配置
在
.babelrc.js中进行配置
module.exports = {
// ...
plugins: [
... other plugins
['babel-plugin-collect-i18n', {
// 模式:只做收集 | 收集并匹配词条输出词条文件,默认为 collect
mode: 'generate',
// 扫描的标识符
name: ['i18n'],
// 输出路径
output: 'src/locale/i18n.js',
// 输出模块类型,支持 commonjs 和 es,默认为 commonjs
moduleType: 'es',
// 与词条 key 相匹配的多语种资源所在位置
locale: 'i18n/index.json',
}],
],
}
