This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
nuxt.config.js
136 lines (135 loc) · 3.71 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
require('dotenv/config');
const path = require('path');
const { PORT } = process.env;
module.exports = {
/**
* Specify application header defaults
*/
head: {
title: 'Simple Todos',
meta: [
{ charset: 'utf-8' },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui'
},
{ hid: 'description', name: 'description', content: 'A simple todos project. Built with 💚 using Nuxt & Nest.' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' },
{ rel: 'stylesheet', href: 'https://unpkg.com/vuetify@next/dist/vuetify.min.css' },
{ rel: 'stylesheet', href: 'https://use.fontawesome.com/releases/v5.0.4/css/all.css' }
]
},
/**
* Customize application loading bar
*/
loading: {
color: '#4CAF50'
},
/**
* Specify build directory
*/
buildDir: 'server/build',
/**
* Specify nuxt source directory
*/
srcDir: 'client',
/**
* Configure & extend Webpack build
*/
build: {
babel: {
plugins: ['transform-decorators-legacy', 'transform-class-properties']
},
vendor: [
'axios',
'vuetify',
'vee-validate',
'nuxt-class-component',
'vue-class-component',
'vue-property-decorator',
'vuex-class'
]
},
/**
* Specify additional nuxt plugins
*/
plugins: [
{
src: '~/plugins/vue-notifications',
ssr: false
},
'~/plugins/vee-validate',
'~/plugins/vuetify'
],
/**
* Specify additional nuxt modules
*/
modules: [
'@nuxtjs/axios',
['@nuxtjs/dotenv', { path: path.resolve('.') }],
['nuxtjs-extensions/typescript', { tsconfig: path.resolve(__dirname, 'client', 'tsconfig.json') }]
],
/**
* Axios module config
*/
axios: {
// baseURL: `http://127.0.0.1:${PORT}/api`,
/**
* Adds an interceptor to automatically set `withCredentials` config of axios
* when requesting to baseUrl which allows passing authentication headers to backend.
*/
credentials: true,
/**
* Adds interceptors to log all responses and requests
*/
debug: false,
/**
* This option is a map from specific error codes to page which they should be redirect.
*
* For example if you want redirecting all `401` errors to `/login`
*/
redirectError: {
// 401: '/login'
},
/**
* Function for manipulating axios requests.
*
* Useful for setting custom headers, for example based on the store state.
* The second argument is the nuxt context.
*/
requestInterceptor: (config, { store }) => {
// append access token to each request
const accessToken = store.getters['auth/accessToken'];
if (accessToken) {
config.headers.common['Authorization'] = `Bearer ${accessToken}`;
}
return config;
},
/**
* Function init(axios, ctx) to do additional things with axios.
*
* Example:
*
* init (axios, ctx) {
* axios.defaults.xsrfHeaderName = 'X-CSRF-TOKEN'
* }
*/
// init: (axios, ctx) => {},
/**
* If you want to disable the default error handler for some reason,
* you can do it so by setting the option `disableDefaultErrorHandler` to `true`.
*/
disableDefaultErrorHandler: true
/**
* Function for custom global error handler.
*
* If you define a custom error handler, the default error handler provided by this package will be overridden.
*/
// errorHandler: (errorReason, { error }) => {
// error('Request Error: ' + errorReason)
// }
}
};