doc: IgnorePlugin => NormalModuleReplacementPlugin, fixed #1315

pull/1578/head
qingwei.li 2016-12-06 17:19:40 +08:00
parent 5ef3a8597b
commit fcf412087c
2 changed files with 5 additions and 5 deletions

View File

@ -26,13 +26,13 @@ Vue.component(Button.name, Button)
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
```javascript
{
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')
]
}
```

View File

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