49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { resolve } from 'path';
|
|
import legacy from '@vitejs/plugin-legacy';
|
|
import postcssPxtorem from 'postcss-pxtorem';
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
function pathResolve(dir: string) {
|
|
return resolve(process.cwd(), '.', dir);
|
|
}
|
|
|
|
export default defineConfig({
|
|
base: '/static/mobile/',
|
|
plugins: [legacy({ targets: ['defaults', 'not IE 11'] }), vue()],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 9000,
|
|
},
|
|
resolve: {
|
|
alias: [
|
|
// /@/xxxx => src/xxxx
|
|
{
|
|
find: /\/@\//,
|
|
replacement: pathResolve('src') + '/',
|
|
},
|
|
// /#/xxxx => types/xxxx
|
|
{
|
|
find: /\/#\//,
|
|
replacement: pathResolve('types') + '/',
|
|
},
|
|
],
|
|
},
|
|
css: {
|
|
// preprocessorOptions: {
|
|
// less: {},
|
|
// },
|
|
postcss: {
|
|
plugins: [
|
|
postcssPxtorem({
|
|
rootValue: 75,
|
|
propList: ['*'],
|
|
selectorBlackList: [/^(?!\.zp-)/],
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
});
|