国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

vue-cli腳手架config目錄下index.js配置文件的方法

2024-05-06 15:20:45
字體:
來源:轉載
供稿:網友

此文章介紹vue-cli腳手架config目錄下index.js配置文件

1、此配置文件是用來定義開發環境和生產環境中所需要的參數

2、關于注釋

當涉及到較復雜的解釋我將通過標識的方式(如(1))將解釋寫到單獨的注釋模塊,請自行查看

3、上代碼

// see http://vuejs-templates.github.io/webpack for documentation.// path是node.js的路徑模塊,用來處理路徑統一的問題var path = require('path')module.exports = { // 下面是build也就是生產編譯環境下的一些配置 build: {  // 導入prod.env.js配置文件,只要用來指定當前環境,詳細見(1)  env: require('./prod.env'),  // 下面是相對路徑的拼接,假如當前跟目錄是config,那么下面配置的index屬性的屬性值就是dist/index.html  index: path.resolve(__dirname, '../dist/index.html'),  // 下面定義的是靜態資源的根目錄 也就是dist目錄  assetsRoot: path.resolve(__dirname, '../dist'),  // 下面定義的是靜態資源根目錄的子目錄static,也就是dist目錄下面的static  assetsSubDirectory: 'static',  // 下面定義的是靜態資源的公開路徑,也就是真正的引用路徑  assetsPublicPath: '/',  // 下面定義是否生成生產環境的sourcmap,sourcmap是用來debug編譯后文件的,通過映射到編譯前文件來實現  productionSourceMap: true,  // 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  // 下面是是否在生產環境中壓縮代碼,如果要壓縮必須安裝compression-webpack-plugin  productionGzip: false,  // 下面定義要壓縮哪些類型的文件  productionGzipExtensions: ['js', 'css'],  // Run the build command with an extra argument to  // View the bundle analyzer report after build finishes:  // `npm run build --report`  // Set to `true` or `false` to always turn it on or off  // 下面是用來開啟編譯完成后的報告,可以通過設置值為true和false來開啟或關閉  // 下面的process.env.npm_config_report表示定義的一個npm_config_report環境變量,可以自行設置  bundleAnalyzerReport: process.env.npm_config_report }, dev: {  // 引入當前目錄下的dev.env.js,用來指明開發環境,詳見(2)  env: require('./dev.env'),  // 下面是dev-server的端口號,可以自行更改  port: 8080,  // 下面表示是否自定代開瀏覽器  autoOpenBrowser: true,  assetsSubDirectory: 'static',  assetsPublicPath: '/',  // 下面是代理表,作用是用來,建一個虛擬api服務器用來代理本機的請求,只能用于開發模式  // 詳見(3)  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.  // 是否生成css,map文件,上面這段英文就是說使用這個cssmap可能存在問題,但是按照經驗,問題不大,可以使用  // 給人覺得沒必要用這個,css出了問題,直接控制臺不就完事了  cssSourceMap: false }}            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 海兴县| 夏邑县| 孟津县| 博乐市| 卓尼县| 资中县| 遂川县| 长春市| 织金县| 博客| 东乌| 瑞丽市| 舞阳县| 安宁市| 彭阳县| 湖南省| 丰县| 石渠县| 泉州市| 华容县| 罗山县| 盐边县| 融水| 洞口县| 内江市| 永新县| 永川市| 浪卡子县| 夹江县| 高唐县| 横峰县| 长乐市| 益阳市| 南华县| 额尔古纳市| 桂林市| 宁城县| 南充市| 堆龙德庆县| 万州区| 祁阳县|