vue-cli4.0 vue.config.js初始配置

const vuxLoader = require('vux-loader')

module.exports = {
  // 将部署应用程序的基本URL
  // 将部署应用程序的基本URL。
  // 默认情况下,Vue CLI假设您的应用程序将部署在域的根目录下。
  // https://www.my-app.com/。如果应用程序部署在子路径上,则需要使用此选项指定子路径。例如,如果您的应用程序部署在https://www.foobar.com/my-app/,集baseUrl到'/my-app/'.

  publicPath: process.env.NODE_ENV === 'production' ? './' : './',

  // outputDir: 在npm run build时 生成文件的目录 type:string, default:'dist'

  outputDir: 'dist',

  // pages:{ type:Object,Default:undfind } 
/*
构建多页面模式的应用程序.每个“页面”都应该有一个相应的JavaScript条目文件。该值应该是一
个对象,其中键是条目的名称,而该值要么是指定其条目、模板和文件名的对象,要么是指定其条目
的字符串,
注意:请保证pages里配置的路径和文件名 在你的文档目录都存在 否则启动服务会报错的
*/
  pages: {
      index: {
          //entry for the page
          entry: 'src/main.js',
          //the source template
          template: 'public/index.html',
          //output as dist/index.html
          filename: 'index.html'
      },
      // when using the entry-only string format,
      // template is inferred to be `public/subpage.html`
      // and falls back to `public/index.html` if not found.
      // Output filename is inferred to be `subpage.html`.
      // subpage: 'src/subpage/main.js'
 },

  //   lintOnSave:{ type:Boolean default:true } 问你是否使用eslint
  lintOnSave: true,
  // productionSourceMap:{ type:Bollean,default:true } 生产源映射
  // 如果您不需要生产时的源映射,那么将此设置为false可以加速生产构建
  productionSourceMap: false,
  // devServer:{type:Object} 3个属性host,port,https
  // 它支持webPack-dev-server的所有选项

  devServer: {
      port: 8090, // 端口号
      host: 'localhost',
      https: false, // https:{type:Boolean}
      open: true, //配置自动启动浏览器
      // proxy: 'http://localhost:4000' // 配置跨域处理,只有一个代理
  },

  css: {
    loaderOptions: {
    css: {},
    postcss: {
        plugins: [
        require('postcss-px2rem')({
            remUnit: 37.5
        })
        ]
        }
    }
  },
}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1 丽丽轻轻地抿了一口酒,辛辣的味道把她呛得咳了起来,脸好像被抹上了一层红晕。 吴水看着更加俏丽的丽丽,心痒难耐。...
    吻过地平线_8781阅读 4,150评论 126 100
  • 今天,ofo宣布完成超过7亿美元新一轮融资,创下共享单车行业单笔最高融资。 反观事件的背后,曾现的是越来越快速的互...
    初凉阿税阅读 358评论 0 0