refactor: fuck vite defineConfig
This commit is contained in:
parent
ea37bb9dff
commit
ca57625cea
1
.github/workflows/docker-image-ci.yml
vendored
1
.github/workflows/docker-image-ci.yml
vendored
@ -2,6 +2,7 @@ name: Docker Image CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches: [ 'dev' ]
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,17 @@ import { fileURLToPath, URL } from 'node:url'
|
|||||||
import { getLastCommit } from 'git-last-commit'
|
import { getLastCommit } from 'git-last-commit'
|
||||||
import VueMacros from 'unplugin-vue-macros/vite'
|
import VueMacros from 'unplugin-vue-macros/vite'
|
||||||
|
|
||||||
// import viteImagemin from 'vite-plugin-imagemin'
|
|
||||||
// import viteCompression from 'vite-plugin-compression'
|
|
||||||
|
|
||||||
const lifecycle = process.env.npm_lifecycle_event
|
const lifecycle = process.env.npm_lifecycle_event
|
||||||
|
|
||||||
// {
|
export default defineConfig(() => {
|
||||||
// name: 'axios',
|
let latestCommitHash = ''
|
||||||
// var: 'axios',
|
|
||||||
// path: 'https://lib.baomitu.com/axios/1.6.8/axios.min.js'
|
|
||||||
// },
|
|
||||||
|
|
||||||
export default defineConfig(async () => {
|
return new Promise((resolve) => {
|
||||||
const latestCommitHash = await new Promise<string>((resolve) => {
|
getLastCommit((err, commit) => {
|
||||||
return getLastCommit((err, commit) => (err ? 'unknown' : resolve(commit.shortHash)))
|
if (!err) {
|
||||||
})
|
latestCommitHash = commit.shortHash
|
||||||
return {
|
}
|
||||||
|
resolve({
|
||||||
base: './',
|
base: './',
|
||||||
envDir: 'env',
|
envDir: 'env',
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -103,11 +98,6 @@ export default defineConfig(async () => {
|
|||||||
// },
|
// },
|
||||||
// }),
|
// }),
|
||||||
],
|
],
|
||||||
define: {
|
|
||||||
LATEST_COMMIT_HASH: JSON.stringify(
|
|
||||||
latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')
|
|
||||||
)
|
|
||||||
},
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
@ -167,6 +157,11 @@ export default defineConfig(async () => {
|
|||||||
},
|
},
|
||||||
assetsInlineLimit: 2048
|
assetsInlineLimit: 2048
|
||||||
},
|
},
|
||||||
|
define: {
|
||||||
|
LATEST_COMMIT_HASH: JSON.stringify(
|
||||||
|
latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')
|
||||||
|
)
|
||||||
|
},
|
||||||
esbuild: {
|
esbuild: {
|
||||||
// drop: ['console', 'debugger']
|
// drop: ['console', 'debugger']
|
||||||
},
|
},
|
||||||
@ -177,6 +172,11 @@ export default defineConfig(async () => {
|
|||||||
fs: {
|
fs: {
|
||||||
strict: false
|
strict: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
port: 5555
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user