You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
import { defineConfig } from 'vite' |
|
import vue from '@vitejs/plugin-vue' |
|
import path from 'path' |
|
// 导入mock插件 |
|
import { viteMockServe } from 'vite-plugin-mock' |
|
// 导入svg配置插件 |
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' |
|
// https://vitejs.dev/config/ |
|
export default ({ command }: any) => { |
|
return { |
|
plugins: [ |
|
vue(), |
|
viteMockServe({ |
|
enable: command === 'serve', |
|
}), |
|
createSvgIconsPlugin({ |
|
// Specify the icon folder to be cached |
|
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')], |
|
// Specify symbolId format |
|
symbolId: 'icon-[dir]-[name]', |
|
}), |
|
], |
|
resolve: { |
|
alias: { |
|
'@': path.resolve('./src'), // 相对路径别名配置,使用 @ 代替 src |
|
}, |
|
}, |
|
// 配置scss |
|
css: { |
|
preprocessorOptions: { |
|
scss: { |
|
javascriptEnabled: true, |
|
additionalData: '@import "./src/styles/variable.scss";', |
|
}, |
|
}, |
|
}, |
|
} |
|
} |
|
|
|
// const webpack = require('webpack') |
|
// module.exports = { |
|
// configureWebpack: { |
|
// plugins: [ |
|
// new webpack.ProvidePlugin({ |
|
// $: 'jquery', |
|
// jQuery: 'jquery', |
|
// 'windows.jQuery': 'jquery' |
|
// }) |
|
// ] |
|
// } |
|
// }
|