mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-23 11:59:34 +08:00
chore: load env file (#6323)
This commit is contained in:
parent
e083447b48
commit
72768935b3
@ -1,6 +1,6 @@
|
||||
import path from 'path'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import DefineOptions from 'unplugin-vue-define-options/vite'
|
||||
import WindiCSS from 'vite-plugin-windicss'
|
||||
import mkcert from 'vite-plugin-mkcert'
|
||||
@ -30,7 +30,8 @@ if (process.env.DOC_ENV !== 'production') {
|
||||
)
|
||||
}
|
||||
|
||||
export default async () => {
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const { dependencies } = getPackageDependencies(epPackage)
|
||||
const optimizeDeps = [
|
||||
'vue',
|
||||
@ -50,10 +51,10 @@ export default async () => {
|
||||
).map((file) => file.replace(/\.js$/, ''))
|
||||
)
|
||||
|
||||
return defineConfig({
|
||||
return {
|
||||
server: {
|
||||
host: true,
|
||||
https: !!process.env.HTTPS,
|
||||
https: !!env.HTTPS,
|
||||
fs: {
|
||||
allow: [projRoot],
|
||||
},
|
||||
@ -95,5 +96,5 @@ export default async () => {
|
||||
optimizeDeps: {
|
||||
include: optimizeDeps,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
@ -24,7 +24,8 @@ const esbuildPlugin = () => ({
|
||||
enforce: 'post',
|
||||
})
|
||||
|
||||
export default defineConfig(async () => {
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const { dependencies } = getPackageDependencies(epPackage)
|
||||
|
||||
const optimizeDeps = (
|
||||
@ -48,7 +49,7 @@ export default defineConfig(async () => {
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
https: !!process.env.HTTPS,
|
||||
https: !!env.HTTPS,
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
|
Loading…
Reference in New Issue
Block a user