@cnhis-frontend/unplugin-i18n-helper
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -16,2 +16,3 @@ import { walk } from "estree-walker"; | ||
transforms?: (Transfrom | string)[]; | ||
jsx?: boolean; | ||
} | ||
@@ -18,0 +19,0 @@ export declare type Visitor = Parameters<typeof walk>[1]; |
{ | ||
"name": "@cnhis-frontend/unplugin-i18n-helper", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"license": "MIT", | ||
@@ -46,7 +46,9 @@ "scripts": { | ||
"dependencies": { | ||
"@rollup/pluginutils": "^5.0.0", | ||
"acorn": "^8.10.0", | ||
"acorn-jsx": "^5.3.2", | ||
"estree-walker": "^2.0.1", | ||
"htmlparser2": "^8.0.1", | ||
"magic-string": "^0.25.7", | ||
"unplugin": "^1.5.0", | ||
"@rollup/pluginutils": "^5.0.0" | ||
"unplugin": "^1.5.0" | ||
}, | ||
@@ -53,0 +55,0 @@ "description": "自动查找 包含中文 的字符串和模板字符串,并替换为自定义的国际化方法", |
@@ -109,2 +109,3 @@ # unplugin-i18n-helper | ||
| output | `boolean` | - | 否 | 是否输出字符串处理的结果 | | ||
| jsx | `boolean` | - | 否 | 针对jsx的处理 | | ||
@@ -157,5 +158,8 @@ | ||
// 因为 babel-loader 对ES6语法做了转义, 而插件执行顺序是在 babel后 | ||
// 所有需要将 babel 处理时机置后 改为enforce="post" | ||
/** | ||
* 方案一 | ||
* 因为 babel-loader 对ES6语法做了转义, 而插件执行顺序是在 babel后 | ||
* 所以需要将 babel 处理时机置后 改为enforce="post" | ||
* 注意js 文件中有 jsx 的代码则要启用配置选项jsx避免报错 | ||
*/ | ||
// vue.config.js | ||
@@ -168,2 +172,18 @@ chainWebpack: config => { | ||
} | ||
/** | ||
* 方案二 | ||
* 若不考虑兼容性问题,可以 exclude 选项 关掉 babel 的 模板字符串 处理插件 | ||
*/ | ||
// babel.config.js | ||
module.exports = { | ||
presets: [ | ||
[ | ||
"@vue/cli-plugin-babel/preset", | ||
{ | ||
exclude: ["transform-template-literals"], | ||
}, | ||
], | ||
], | ||
}; | ||
``` | ||
@@ -170,0 +190,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85274
1774
195
7
+ Addedacorn@^8.10.0
+ Addedacorn-jsx@^5.3.2
+ Addedacorn-jsx@5.3.2(transitive)