fix: fix full bundle export (#1350)

* fix: fix full bundle export

* chore: update
This commit is contained in:
zazzaz 2021-01-25 22:42:25 +08:00 committed by GitHub
parent ed1871fe28
commit fbf5267de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -19,7 +19,9 @@ const plugins = [
new VueLoaderPlugin(),
// new BundleAnalyzerPlugin(),
]
let entry = [path.resolve(__dirname, '../packages/element-plus/index.ts')]
const entry = path.resolve(__dirname, '../packages/element-plus/index.ts')
if (!isFullMode) {
externals.push({
'@popperjs/core': '@popperjs/core',
@ -30,8 +32,6 @@ if (!isFullMode) {
},
/^dayjs.*/,
/^lodash.*/)
} else {
entry.push(path.resolve(__dirname, '../packages/element-plus/full.ts'))
}
const config = {

View File

@ -1,4 +0,0 @@
import dayjs from 'dayjs'
// expose Day.js to window to make full bundle i18n work
(window as any).dayjs = dayjs

View File

@ -95,6 +95,13 @@ import { use, i18n } from '@element-plus/locale'
import { version as version_ } from './version'
import type { InstallOptions } from '@element-plus/utils/config'
import { setConfig } from '@element-plus/utils/config'
import isServer from '@element-plus/utils/isServer'
import dayjs from 'dayjs'
// expose Day.js to window to make full bundle i18n work
if (!isServer && !(window as any).dayjs) {
(window as any).dayjs = dayjs
}
const version = version_ // version_ to fix tsc issue