49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import { defineConfig,normalizePath } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { resolve } from 'path';
|
|
import path from 'path';
|
|
|
|
import cesium from 'vite-plugin-cesium'
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue(),cesium(),
|
|
createSvgIconsPlugin({
|
|
iconDirs: [resolve(process.cwd(), 'src/assets/img/svg')],
|
|
symbolId: 'icon-[dir]-[name]',
|
|
}),
|
|
// 运行和构建时copy
|
|
viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: normalizePath(path.resolve(__dirname, './node_modules/earthsdk3-assets')),
|
|
dest: './js/earthsdk3-assets'
|
|
}
|
|
]
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
// @ 替代为 src
|
|
'@': resolve(__dirname, 'src'),
|
|
// @component 替代为 src/component
|
|
'@components': resolve(__dirname, 'src/components'),
|
|
},
|
|
},
|
|
css: {
|
|
// css预处理器
|
|
preprocessorOptions: {
|
|
less: {
|
|
charset: false,
|
|
additionalData: '@import "./src/assets/style/global.less";',
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 9001, // 指定启动端口
|
|
open: true // 启动后自动打开浏览器
|
|
},
|
|
})
|