浏览代码

doc: IgnorePlugin => NormalModuleReplacementPlugin, fixed #1315

qingwei.li 8 年之前
父节点
当前提交
fcf412087c
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 2 2
      examples/docs/en-US/i18n.md
  2. 3 3
      examples/docs/zh-CN/i18n.md

+ 2 - 2
examples/docs/en-US/i18n.md

@@ -26,13 +26,13 @@ Vue.component(Button.name, Button)
 Vue.component(Select.name, Select)
 Vue.component(Select.name, Select)
 ```
 ```
 
 
-The Chinese language pack is imported by default, even if you're using another language. But with `IgnorePlugin` provided by webpack you can ignore it when building:
+The Chinese language pack is imported by default, even if you're using another language. But with `NormalModuleReplacementPlugin` provided by webpack you can replace default locale:
 
 
 webpack.config.js
 webpack.config.js
 ```javascript
 ```javascript
 {
 {
   plugins: [
   plugins: [
-    new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-CN/)
+    new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
   ]
   ]
 }
 }
 ```
 ```

+ 3 - 3
examples/docs/zh-CN/i18n.md

@@ -38,13 +38,13 @@ Vue.component(Button.name, Button)
 Vue.component(Select.name, Select)
 Vue.component(Select.name, Select)
 ```
 ```
 
 
-如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 IgnorePlugin 忽略掉它以减少打包后的文件体积
+如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 NormalModuleReplacementPlugin 替换默认语言包
 
 
 **webpack.config.js**
 **webpack.config.js**
 ```javascript
 ```javascript
 {
 {
   plugins: [
   plugins: [
-    new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-CN/)
+    new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
   ]
   ]
 }
 }
 ```
 ```
@@ -64,5 +64,5 @@ Vue.component(Select.name, Select)
   <li>韩语(ko)</li>
   <li>韩语(ko)</li>
   <li>日语(ja)</li>
   <li>日语(ja)</li>
 </ul>
 </ul>
- 
+
 如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。
 如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。