zoukankan      html  css  js  c++  java
  • vue项目中config文件中的 index.js 配置

    var path = require('path')
    
    module.exports = {
      build: { // production(生产) 环境
        env: require('./prod.env'), // 使用 config/prod.env.js 中定义的编译环境
        index: path.resolve(__dirname, '../dist/index.html'), // 编译输入的 index.html 文件
        assetsRoot: path.resolve(__dirname, '../dist'), // 编译输出的静态资源路径
        assetsSubDirectory: 'static', // 编译输出的二级目录
        assetsPublicPath: '/', // 编译发布的根目录,可配置为资源服务器域名或 CDN 域名
        productionSourceMap: true, // 是否开启 cssSourceMap
        // Gzip off by default as many popular static hosts such as
        // Surge or Netlify already gzip all static assets for you.
        // Before setting to `true`, make sure to:
        // npm install --save-dev compression-webpack-plugin
        productionGzip: false, // 是否开启 gzip
        productionGzipExtensions: ['js', 'css'] // 需要使用 gzip 压缩的文件扩展名
      },
      dev: { // dev(开发) 环境
        env: require('./dev.env'), // 使用 config/dev.env.js 中定义的编译环境
        port: 8080, // 运行测试页面的端口
        assetsSubDirectory: 'static', // 编译输出的二级目录
        assetsPublicPath: '/', // 编译发布的根目录,可配置为资源服务器域名或 CDN 域名
        proxyTable: {}, // 需要 proxyTable 代理的接口(可跨域)
        // CSS Sourcemaps off by default because relative paths are "buggy"
        // with this option, according to the CSS-Loader README
        // (https://github.com/webpack/css-loader#sourcemaps)
        // In our experience, they generally work as expected,
        // just be aware of this issue when enabling this option.
        cssSourceMap: false, // 是否开启 cssSourceMap
      autoOpenBrowser: true, // 自动打开浏览器
      
    } }

    var path = require('path')
    module.exports = {  build: { // production 环境    env: require('./prod.env'), // 使用 config/prod.env.js 中定义的编译环境    index: path.resolve(__dirname, '../dist/index.html'), // 编译输入的 index.html 文件    assetsRoot: path.resolve(__dirname, '../dist'), // 编译输出的静态资源路径    assetsSubDirectory: 'static', // 编译输出的二级目录    assetsPublicPath: '/', // 编译发布的根目录,可配置为资源服务器域名或 CDN 域名    productionSourceMap: true, // 是否开启 cssSourceMap    // Gzip off by default as many popular static hosts such as    // Surge or Netlify already gzip all static assets for you.    // Before setting to `true`, make sure to:    // npm install --save-dev compression-webpack-plugin    productionGzip: false, // 是否开启 gzip    productionGzipExtensions: ['js', 'css'] // 需要使用 gzip 压缩的文件扩展名  },  dev: { // dev 环境    env: require('./dev.env'), // 使用 config/dev.env.js 中定义的编译环境    port: 8080, // 运行测试页面的端口    assetsSubDirectory: 'static', // 编译输出的二级目录    assetsPublicPath: '/', // 编译发布的根目录,可配置为资源服务器域名或 CDN 域名    proxyTable: {}, // 需要 proxyTable 代理的接口(可跨域)    // CSS Sourcemaps off by default because relative paths are "buggy"    // with this option, according to the CSS-Loader README    // (https://github.com/webpack/css-loader#sourcemaps)    // In our experience, they generally work as expected,    // just be aware of this issue when enabling this option.    cssSourceMap: false // 是否开启 cssSourceMap  }}

  • 相关阅读:
    经典网页设计:漂亮的个人作品集网站设计欣赏【中篇】
    引领网页设计潮流的优秀网页作品赏析《第二季》
    Chance – 功能强大的 JavaScript 随机数生成类库
    设计前沿:16款扁平风格 iOS 7 图标设计
    TwentyTwenty – 使用 jQuery 实现图片对比功能
    未来的 Web:九个不可思议的 WebGL 应用试验
    推荐25个帮助你提高技能的 CSS3 实战教程
    经典网页设计:顶尖的个人作品集网站设计欣赏【上篇】
    Smint – 用于单页网站制作的 jQuery 导航菜单插件
    关注经典:CSS Awards 获奖网站作品赏析《第一季》
  • 原文地址:https://www.cnblogs.com/maxiag/p/11986131.html
Copyright © 2011-2022 走看看