在首屏加載資源較多,可能會出現白屏和閃屏的狀況。體驗很差。盜圖一波,小米商城使用骨架屏進行首屏在資源數據尚未加載完成時顯示,給很好的體驗效果。php
1 'use strict' 2 // Template version: 1.3.1 3 // see http://vuejs-templates.github.io/webpack for documentation. 4 5 const path = require('path') 6 7 module.exports = { 8 dev: { 9 10 // Paths 11 assetsSubDirectory: 'static', 12 assetsPublicPath: '/', 13 proxyTable: {}, 14 15 // Various Dev Server settings 16 host: 'localhost', // can be overwritten by process.env.HOST 17 port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 autoOpenBrowser: false, 19 errorOverlay: true, 20 notifyOnErrors: true, 21 poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 23 24 /** 25 * Source Maps 26 */ 27 28 // https://webpack.js.org/configuration/devtool/#development 29 devtool: 'cheap-module-eval-source-map', 30 31 // If you have problems debugging vue-files in devtools, 32 // set this to false - it *may* help 33 // https://vue-loader.vuejs.org/en/options.html#cachebusting 34 cacheBusting: true, 35 36 cssSourceMap: true 37 }, 38 39 build: { 40 // Template for index.html 41 index: path.resolve(__dirname, '../dist/ndindex.html'), 42 43 // Paths 44 assetsRoot: path.resolve(__dirname, '../dist'), 45 assetsSubDirectory: 'static', 46 assetsPublicPath: './', 47 48 /** 49 * Source Maps 50 */ 51 52 productionSourceMap: false, 53 // https://webpack.js.org/configuration/devtool/#production 54 devtool: '#source-map', 55 56 // Gzip off by default as many popular static hosts such as 57 // Surge or Netlify already gzip all static assets for you. 58 // Before setting to `true`, make sure to: 59 // npm install --save-dev compression-webpack-plugin 60 productionGzip: true, 61 productionGzipExtensions: ['js', 'css','svg'], 62 63 // Run the build command with an extra argument to 64 // View the bundle analyzer report after build finishes: 65 // `npm run build --report` 66 // Set to `true` or `false` to always turn it on or off 67 bundleAnalyzerReport: process.env.npm_config_report 68 } 69 }
1 'use strict' 2 // Template version: 1.3.1 3 // see http://vuejs-templates.github.io/webpack for documentation. 4 const path = require('path') 5 module.exports = { 6 build: { 7 // Template for index.html 8 index: path.resolve(__dirname, '../dist/ndindex.html'), 9 10 // Paths 11 assetsRoot: path.resolve(__dirname, '../dist'), 12 assetsSubDirectory: 'static', 13 assetsPublicPath: './', 14 15 /** 16 * Source Maps 17 */ 18 19 productionSourceMap: false, 20 // https://webpack.js.org/configuration/devtool/#production 21 devtool: '#source-map', 22 23 // Gzip off by default as many popular static hosts such as 24 // Surge or Netlify already gzip all static assets for you. 25 // Before setting to `true`, make sure to: 26 // npm install --save-dev compression-webpack-plugin 27 productionGzip: true, 28 productionGzipExtensions: ['js', 'css','svg'], 29 30 // Run the build command with an extra argument to 31 // View the bundle analyzer report after build finishes: 32 // `npm run build --report` 33 // Set to `true` or `false` to always turn it on or off 34 bundleAnalyzerReport: process.env.npm_config_report 35 } 36 }