-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
71 lines (65 loc) · 1.83 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
const webpack = require('webpack')
export default {
// Global page headers (https://go.nuxtjs.dev/config-head)
head: {
title: 'nuxt项目',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
// Global CSS (https://go.nuxtjs.dev/config-css)
css: [
//配置elementui
'element-ui/lib/theme-chalk/index.css',
'~/assets/css/reset.css',
'~/assets/css/global.css'
],
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
// ssr: true表示这个插件只在服务端起作用
'~/plugins/ElementUI',
],
// Auto import components (https://go.nuxtjs.dev/config-components)
components: true,
// Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
buildModules: [
],
// Modules (https://go.nuxtjs.dev/config-modules)
modules: [
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
axios: {
proxy: true, // 表示开启代理
//timeout: 5000,
//prefix: '/api', // 表示给请求url加个前缀 /api
//withCredentials: true // 表示跨域请求时是否需要使用凭证
credentials:true
},
proxy: {
'/api/': {
target: 'https://localhost:5001',// 接口
ws:true,
secure:false,
changeOrigin:true,//表示是否跨域
pathRewrite: {
//'^/api': '', // 把 /api 替换成 /
}
}
},
// Build Configuration (https://go.nuxtjs.dev/config-build)
build: {
// 防止element-ui、axios被多次打包
vendor: ['element-ui','axios'],
plugins: [
new webpack.ProvidePlugin({
'$' : 'jquery'
})
]
}
}