mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 04:27:26 +08:00
fix(build): locale export default (#5576)
This commit is contained in:
@ -58,10 +58,10 @@ If you are using Element Plus via CDN, then you need to do this, let's again tak
|
||||
unpkg as an example
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/element-plus/dist/locale/zh-cn">
|
||||
<script>
|
||||
<script src="//unpkg.com/element-plus/dist/locale/zh-cn"></script>
|
||||
<script>
|
||||
app.use(ElementPlus, {
|
||||
locale: ElementPlus.lang.zhCn
|
||||
locale: ElementPlusLocaleZhCn,
|
||||
})
|
||||
</script>
|
||||
```
|
||||
@ -130,27 +130,8 @@ If you need any other languages, [PR](https://github.com/element-plus/element-pl
|
||||
is always welcomed, you only need to add a language file at
|
||||
[here](https://github.com/element-plus/element-plus/tree/dev/packages/locale/lang).
|
||||
|
||||
## FAQs
|
||||
|
||||
### If I want to replace the default language pack to reduce the size, how do I do?
|
||||
|
||||
When the default language of your app is not **English**, you will be going to need
|
||||
to import another language file, which will increase the bundle size since you have
|
||||
both **English** and **Your desired language** bundled,
|
||||
you can use the plugin [NormalModuleReplacementPlugin](https://webpack.js.org/plugins/normal-module-replacement-plugin/#root)
|
||||
provided by [webpack](https://webpack.js.org) to replace the default language file,
|
||||
so that you will only get **1** language file bundled.
|
||||
Add the code below into your `webpack.config.js` to get it work.
|
||||
|
||||
> webpack.config.js
|
||||
|
||||
```typescript
|
||||
{
|
||||
plugins: [
|
||||
new webpack.NormalModuleReplacementPlugin(
|
||||
/element-plus[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]en/,
|
||||
'element-plus/lib/locale/lang/zh-cn'
|
||||
),
|
||||
]
|
||||
}
|
||||
```
|
||||
<style>
|
||||
.language-list {
|
||||
list-style: disc
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user