2021-12-26 09:14:46 +00:00
|
|
|
|
// .fes.js 只负责管理编译时配置,只能使用plain Object
|
2021-12-27 09:37:41 +00:00
|
|
|
|
import ESLintPlugin from 'eslint-webpack-plugin'
|
2021-12-27 07:26:40 +00:00
|
|
|
|
import StylelintPlugin from 'stylelint-webpack-plugin'
|
2021-12-27 11:07:17 +00:00
|
|
|
|
import AutoImportPlugin from 'unplugin-auto-import/webpack'
|
2021-12-27 11:23:47 +00:00
|
|
|
|
import VueComponentsPlugin from 'unplugin-vue-components/webpack'
|
2021-12-27 11:37:31 +00:00
|
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
2021-12-26 09:14:46 +00:00
|
|
|
|
|
|
|
|
|
export default {
|
2021-12-27 02:44:31 +00:00
|
|
|
|
publicPath: './',
|
2021-12-27 07:06:11 +00:00
|
|
|
|
alias: {
|
|
|
|
|
'~': '/src',
|
|
|
|
|
},
|
2021-12-27 02:44:31 +00:00
|
|
|
|
access: {
|
|
|
|
|
roles: {
|
|
|
|
|
admin: ['*'],
|
|
|
|
|
manager: ['/'],
|
2021-12-26 09:14:46 +00:00
|
|
|
|
},
|
2021-12-27 02:44:31 +00:00
|
|
|
|
},
|
|
|
|
|
layout: {
|
|
|
|
|
title: 'Fes.js',
|
|
|
|
|
footer: 'Created by MumbleFe',
|
|
|
|
|
multiTabs: false,
|
|
|
|
|
menus: [
|
|
|
|
|
{
|
|
|
|
|
name: 'index',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
devServer: {
|
|
|
|
|
port: 8000,
|
|
|
|
|
},
|
|
|
|
|
enums: {
|
|
|
|
|
status: [
|
|
|
|
|
['0', '无效的'],
|
|
|
|
|
['1', '有效的'],
|
|
|
|
|
],
|
|
|
|
|
},
|
2021-12-27 07:26:40 +00:00
|
|
|
|
chainWebpack(config) {
|
2021-12-27 09:37:41 +00:00
|
|
|
|
config.plugin('eslint').use(ESLintPlugin, [
|
|
|
|
|
{
|
|
|
|
|
files: 'src/**/*.{js,ts,tsx,vue}',
|
|
|
|
|
},
|
|
|
|
|
])
|
2021-12-27 07:26:40 +00:00
|
|
|
|
config.plugin('stylelint').use(StylelintPlugin, [
|
|
|
|
|
{
|
|
|
|
|
extensions: ['css', 'scss', 'vue', 'tsx'],
|
|
|
|
|
},
|
|
|
|
|
])
|
2021-12-27 11:07:17 +00:00
|
|
|
|
config.plugin('auto-import').use(
|
|
|
|
|
AutoImportPlugin({
|
|
|
|
|
dts: './src/types/auto-imports.d.ts',
|
|
|
|
|
include: [
|
|
|
|
|
/src\/.+\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
|
|
|
|
/src\/.+\.vue$/,
|
|
|
|
|
/src\/.+\.vue\?vue/, // .vue
|
|
|
|
|
/src\/.+\.md$/, // .md
|
|
|
|
|
],
|
|
|
|
|
// global imports to register
|
|
|
|
|
imports: [
|
|
|
|
|
// presets
|
|
|
|
|
'vue',
|
|
|
|
|
'vue-router',
|
|
|
|
|
],
|
2021-12-27 11:37:31 +00:00
|
|
|
|
resolvers: [ElementPlusResolver()],
|
2021-12-27 11:07:17 +00:00
|
|
|
|
}),
|
|
|
|
|
)
|
2021-12-27 11:23:47 +00:00
|
|
|
|
config.plugin('vue-components').use(
|
|
|
|
|
VueComponentsPlugin({
|
|
|
|
|
dts: './src/types/components.d.ts',
|
|
|
|
|
include: [
|
|
|
|
|
/src\/.+\.vue$/,
|
|
|
|
|
/src\/.+\.vue\?vue/, // .vue
|
|
|
|
|
],
|
2021-12-27 11:37:31 +00:00
|
|
|
|
resolvers: [ElementPlusResolver()],
|
2021-12-27 11:23:47 +00:00
|
|
|
|
}),
|
|
|
|
|
)
|
2021-12-27 11:37:31 +00:00
|
|
|
|
// Temporary workaround for Element Plus + unplugin-vue-components bug when importing `v-loading`
|
|
|
|
|
// See: https://github.com/element-plus/element-plus/issues/4855
|
|
|
|
|
config.externals({
|
|
|
|
|
'element-plus/es/components/loading-directive/style/css': 'undefined',
|
|
|
|
|
})
|
2021-12-27 07:26:40 +00:00
|
|
|
|
},
|
2021-12-27 02:44:31 +00:00
|
|
|
|
}
|