区分环境进行按需加载,提升本地开发加载速度。

更改侧边栏活跃色,让其和element-ui皮肤统一。
修复issue https://github.com/flipped-aurora/gin-vue-admin/issues/1347
This commit is contained in:
piexlmax
2023-02-18 14:08:42 +08:00
parent 0eea78f796
commit 2de7d34b4a
10 changed files with 78 additions and 41 deletions

View File

@@ -0,0 +1,25 @@
import * as path from 'path'
export default function fullImportPlugin() {
let config
return {
name: 'fullImportElementPlus',
async configResolved(conf) {
config = conf
},
transform(code, id) {
const sourcePath = path.join(config.root, 'src/main.js').split(path.sep).join('/')
const targetPath = id.split(path.sep).join('/')
if (sourcePath === targetPath) {
const name = 'ElementPlus'
// 引入 ElementPlus 和 样式
const prepend = `import ${name} from 'element-plus';\nimport 'element-plus/theme-chalk/src/index.scss';\n`
code = code.replace('.mount(', ($1) => `.use(${name})` + $1)
return prepend + code
}
return code
}
}
}