1. const path = require('path')
    2. module.exports = {
    3. publicPath: './', // vueConf.baseUrl, // 根域上下文目录
    4. // outputDir: 'dist', // 构建输出目录
    5. // assetsDir: 'assets', // 静态资源目录 (js, css, img, fonts)
    6. lintOnSave: true, // 是否开启eslint保存检测,有效值:ture | false | 'error'
    7. // runtimeCompiler: true, // 运行时版本是否需要编译
    8. transpileDependencies: [], // 默认babel-loader忽略mode_modules,这里可增加例外的依赖包名
    9. productionSourceMap: false, // 是否在构建生产包时生成 sourceMap 文件,false将提高构建速度
    10. css: {
    11. // 配置高于chainWebpack中关于css loader的配置
    12. // modules: true, // 是否开启支持‘foo.module.css’样式
    13. // extract: true, // 是否使用css分离插件 ExtractTextPlugin,采用独立样式文件载入,不采用<style>方式内联至html文件中
    14. // sourceMap: false, // 是否在构建样式地图,false将提高构建速度
    15. loaderOptions: { // css预设器配置项
    16. // less: {
    17. // loaderOptions: {
    18. // data: `@import "@/assets/less/global.less";`
    19. // }
    20. // }
    21. }
    22. },
    23. parallel: require('os').cpus().length > 1, // 构建时开启多进程处理babel编译
    24. pluginOptions: {
    25. 'style-resources-loader': {
    26. preProcessor: 'less',
    27. patterns: [path.resolve(__dirname, './src/assets/less/global.less')]
    28. }
    29. },
    30. pwa: {
    31. // 单页插件相关配置 https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
    32. },
    33. devServer: {
    34. open: true,
    35. host: '0.0.0.0',
    36. port: 8081,
    37. https: false,
    38. hotOnly: false,
    39. // proxy: null
    40. proxy: {
    41. '/api': {
    42. target: '',//请求地址
    43. ws: true,
    44. changeOrigin: true,
    45. pathRewrite: {
    46. '^/api': '' //请求地址
    47. } } } // before: app => {} } }