-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnuxt.config.js
107 lines (107 loc) · 2.85 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
module.exports = {
/*
** Headers of the page
*/
head: {
titleTemplate: '%s - CNode 社区',
meta: [{
charset: 'utf-8'
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1'
},
{
hid: 'description',
name: 'description',
content: 'Nuxt.js project'
}
],
link: [{
rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico'
}, {
rel: 'stylesheet',
href: 'https://cdn.bootcss.com/mini.css/2.3.7/mini-default.min.css'
}],
script: [
{src: 'https://hm.baidu.com/hm.js?a8f76b33f969e78c5e0166414e724649'}
]
},
css: [
{src: '~assets/styles/common.scss', lang: 'sass'}
],
env: {
baseUrl: 'https://news-at.zhihu.com/api/4'
},
modules: [
'@nuxtjs/axios',
// '@nuxtjs/proxy'
],
axios: {
baseURL: 'https://cnodejs.org/api/v1',
// browserBaseURL: 'https://example.com/api',
// debug: true,
// proxy: true
},
// proxy: [
// [
// '/',
// {
// target: 'https://news-at.zhihu.com', // api主机
// // pathRewrite: {'^/': '/api/4/'}
// // pathRewrite: {
// // '^/api': '/'
// // }
// }
// ]
// ],
/*
** Customize the progress bar color
*/
loading: {
color: '#3B8070'
},
/*
** Build configuration
*/
plugins: [
'~plugins/global',
'~plugins/axios',
'~plugins/filters',
'~plugins/ga',
],
build: {
/*
** Run ESLint on save
*/
extend(config, { isDev, isClient }) {
const sassResourcesLoader = {
loader: 'sass-resources-loader',
options: {
resources: [
'assets/styles/mixins.scss'
]
}
}
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
config.module.rules.forEach((rule) => {
if (rule.test.toString() === '/\\.vue$/') {
rule.options.loaders.sass.push(sassResourcesLoader)
rule.options.loaders.scss.push(sassResourcesLoader)
}
if (['/\\.sass$/', '/\\.scss$/'].indexOf(rule.test.toString()) !== -1) {
rule.use.push(sassResourcesLoader)
}
})
}
}
}