-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnuxt.config.js
66 lines (65 loc) · 1.76 KB
/
nuxt.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var FileConfigPath = require('./aliasConfig/index')
module.exports = {
/*
** Headers of the page
*/
head: {
meta: [
{ charset: 'utf-8' },
{ 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' },
{ 'http-equiv': 'cache-control', content: 'no-cache' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
{ hid: 'description', name: 'description', content: 'learn ssr' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/* common css */
css: [
'./assets/reset.scss',
'./assets/common.scss'
],
/*
** Customize the progress bar color
*/
loading: { color: '#3B8070' },
/*
** Build configuration
*/
build: {
/*
** Run ESLint on save
*/
extend (config, { isDev, isClient }) {
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
/* 为了支持object.assign用法(并非绝对,因为项目为pc端可以忽略打包后85k的大小,能更加有效的支持es6) */
config.entry['polyfill'] = ['babel-polyfill']
/* add alias 配置 */
Object.assign(config.resolve.alias, FileConfigPath)
},
/* 为了避免axios被重复打包 (在多个页面使用了import axios的情况下) */
vendor: ['axios', './plugins/iview.js'],
postcss: [
require('postcss-px2rem')({ remUnit: 128 })
]
},
router: {
// Run the middleware/authentication.js on every pages
middleware: 'authentication'
},
modules: [
'@nuxtjs/axios'
],
/* ssr default true */
plugins: [
'./plugins/iview.js'
]
}