Skip to content

Commit

Permalink
feat: support legacy browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
logustra committed May 16, 2021
1 parent 1aec403 commit 8fa9509
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@commitlint/config-conventional": "^12.1.4",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"@vitejs/plugin-legacy": "^1.3.4",
"chalk": "^4.1.1",
"commander": "^7.2.0",
"commitizen": "^4.2.4",
Expand Down
32 changes: 29 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 22 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import ViteLegacy from '@vitejs/plugin-legacy'
import ViteComponents, { ElementPlusResolver } from 'vite-plugin-components'
import ViteIcons, { ViteIconsResolver } from 'vite-plugin-icons'
import ViteFonts from 'vite-plugin-fonts'
Expand All @@ -14,14 +15,6 @@ export default defineConfig(({ mode }) => {
const isProd = mode === 'production'
const isReport = mode === 'report'

let build = {}
if (isProd) {
build = {
manifest: true,
polyfillDynamicImport: true
}
}

const plugins = [
Vue(),

Expand Down Expand Up @@ -85,6 +78,27 @@ export default defineConfig(({ mode }) => {
ViteYaml()
]

let build = {}
if (isProd) {
build = {
manifest: true
}

plugins.push(
/**
* DESC:
* provides support for legacy browsers
* that do not support native ESM
*/
ViteLegacy({
targets: [
'defaults',
'not IE 11'
]
})
)
}

if (isReport) {
plugins.push(
/**
Expand Down

0 comments on commit 8fa9509

Please sign in to comment.