const { defineConfig } = require('@vue/cli-service') const path = require('path') const postcssPxToRem = require("postcss-pxtorem") // function resolve(dir) { // return path.join(__dirname, dir); // } module.exports = defineConfig({ publicPath: './', transpileDependencies:true, lintOnSave:false, devServer: { host: '0.0.0.0', port: 8080, client: { webSocketURL: 'ws://0.0.0.0:8080/ws', }, headers: { 'Access-Control-Allow-Origin': '*', } }, chainWebpack: config => { //svg图标加载 config.module .rule('svg') .exclude.add(path.join(__dirname, 'src/assets/icons/svg')) .end() config.module .rule('icons') .test(/\.svg$/) .include.add(path.join(__dirname, 'src/assets/icons')) .end() .use('svg-sprite-loader') .loader('svg-sprite-loader') .options({ symbolId: 'icon-[name]' }) .end() }, css: { loaderOptions: { postcss: { postcssOptions: { plugins: [ postcssPxToRem({ rootValue: 16, // 基准值,根据设计稿调整 propList: ['*'], // 需要转换的属性,这里设置为全部 }) ] } } } } })