|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { defineConfig } from 'vite' |
|
|
|
|
import { defineConfig , loadEnv} from 'vite' |
|
|
|
|
import vue from '@vitejs/plugin-vue' |
|
|
|
|
import path from 'path' |
|
|
|
|
|
|
|
|
|
@ -8,47 +8,58 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
|
|
|
|
|
import svgLoader from 'vite-svg-loader' |
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
export default defineConfig({ |
|
|
|
|
plugins: [ |
|
|
|
|
vue(), |
|
|
|
|
svgLoader(), |
|
|
|
|
AutoImport({ |
|
|
|
|
imports: [ |
|
|
|
|
'vue' |
|
|
|
|
], |
|
|
|
|
resolvers: [ElementPlusResolver()], |
|
|
|
|
}), |
|
|
|
|
Components({ |
|
|
|
|
resolvers: [ElementPlusResolver({ |
|
|
|
|
importStyle: "sass" |
|
|
|
|
})], |
|
|
|
|
}), |
|
|
|
|
], |
|
|
|
|
resolve: { |
|
|
|
|
// https://cn.vitejs.dev/config/#resolve-alias
|
|
|
|
|
alias: { |
|
|
|
|
// 设置别名
|
|
|
|
|
'~/': `${path.resolve(__dirname, 'src')}/`, |
|
|
|
|
'@': path.resolve(__dirname, './src/') |
|
|
|
|
export default ({ mode }) => { |
|
|
|
|
const env = loadEnv(mode, process.cwd()); |
|
|
|
|
return defineConfig({ |
|
|
|
|
base: env.VITE_BASE, |
|
|
|
|
define: { |
|
|
|
|
'process.env': env |
|
|
|
|
}, |
|
|
|
|
// https://cn.vitejs.dev/config/#resolve-extensions
|
|
|
|
|
extensions: ['.js'] |
|
|
|
|
}, |
|
|
|
|
css: { |
|
|
|
|
preprocessorOptions: { |
|
|
|
|
scss: { |
|
|
|
|
additionalData: `@use "src/assets/style/element.scss" as *;` |
|
|
|
|
plugins: [ |
|
|
|
|
vue(), |
|
|
|
|
svgLoader(), |
|
|
|
|
AutoImport({ |
|
|
|
|
imports: [ |
|
|
|
|
'vue' |
|
|
|
|
], |
|
|
|
|
resolvers: [ElementPlusResolver()], |
|
|
|
|
}), |
|
|
|
|
Components({ |
|
|
|
|
resolvers: [ElementPlusResolver({ |
|
|
|
|
importStyle: "sass" |
|
|
|
|
})], |
|
|
|
|
}), |
|
|
|
|
], |
|
|
|
|
resolve: { |
|
|
|
|
// https://cn.vitejs.dev/config/#resolve-alias
|
|
|
|
|
alias: { |
|
|
|
|
// 设置别名
|
|
|
|
|
'~/': `${path.resolve(__dirname, 'src')}/`, |
|
|
|
|
'@': path.resolve(__dirname, './src/') |
|
|
|
|
}, |
|
|
|
|
// https://cn.vitejs.dev/config/#resolve-extensions
|
|
|
|
|
extensions: ['.js'] |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
server: { |
|
|
|
|
host: '0.0.0.0', |
|
|
|
|
proxy: { |
|
|
|
|
'/api': { |
|
|
|
|
target: 'http://127.0.0.1:8083', |
|
|
|
|
changeOrigin: true, |
|
|
|
|
rewrite: (p) => p.replace(/^\/api/, '') |
|
|
|
|
css: { |
|
|
|
|
preprocessorOptions: { |
|
|
|
|
scss: { |
|
|
|
|
additionalData: `@use "src/assets/style/element.scss" as *;` |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
server: { |
|
|
|
|
host: '0.0.0.0', |
|
|
|
|
proxy: { |
|
|
|
|
'/admin-api': { |
|
|
|
|
target: 'http://127.0.0.1:8083', |
|
|
|
|
changeOrigin: true, |
|
|
|
|
rewrite: (p) => p.replace(/^\/admin-api/, '') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|