2.vue脚手架项目配置

1.更改网站名:

index.html

 1 <!DOCTYPE html>
 2 <html>
 3   <head>
 4     <meta charset="utf-8">
 5     <meta name="viewport" content="width=device-width,initial-scale=1.0">
 6     <title>时光客栈</title>
 7   </head>
 8   <body>
 9     <div id="app"></div>
10     <!-- built files will be auto injected -->
11   </body>
12 </html>

查看效果:

2.更改项目端口号8090:

config/index.js

 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: 8090, // 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/index.html'),
42 
43     // Paths
44     assetsRoot: path.resolve(__dirname, '../dist'),
45     assetsSubDirectory: 'static',
46     assetsPublicPath: '/',
47 
48     /**
49      * Source Maps
50      */
51 
52     productionSourceMap: true,
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: false,
61     productionGzipExtensions: ['js', 'css'],
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 }

查看效果:

猜你喜欢

转载自www.cnblogs.com/TimerHotel/p/vue_02.html