-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnuxt.config.js
112 lines (102 loc) · 2.72 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
const pkg = require('./package')
module.exports = {
mode: 'universal',
server: {
port: process.env.PORT || 8000,
host: '0.0.0.0'
},
/*
** Headers of the page
*/
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width,minimum-scale=1' },
{ name: 'mobile-web-app-capable', content: 'yes' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'apple-mobile-web-app-status-bar-style', content: 'default' },
{ name: 'apple-mobile-web-app-status-bar-style', content: 'default' },
{ name: 'theme-color', content: '#1c79c0' },
],
link: [
{ rel: 'manifest', href: '/manifest.json' },
{ rel: 'shortcut icon', sizes: '48x48', href: 'https://staticv4.imgix.net/partners/amp_favicon.png?v=3' },
{ rel: 'apple-touch-icon', sizes: '120x120', href: 'https://staticv4.imgix.net/partners/amp_favicon.png?v=3' }
]
},
// Disable loading bar since AMP will not use client side navigation
loading: false,
render: {
// Disable resourceHints since we don't load any scripts for AMP
resourceHints: false
},
/*
** Global CSS
*/
css: [],
loaders: {},
/*
** Plugins to load before mounting the App
*/
plugins: [
'./plugins/globals'
],
router: {
extendRoutes(routes, resolve) {
routes.push({
name: 'section',
path: '/:section/:page?',
component: resolve('pages/index.vue')
})
}
},
serverMiddleware: [
'./middleware/redirect'
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
// inject custom props from server request
'./modules/appConfigInjector',
// inject required AMP boilerplate in head tag
'./modules/ampBoilerplate',
// to avoid {{}} interpolator clashes, inject mustache templates as script (not compiled)
'./modules/ampMustacheTemplates',
// clean and validate HTML output against AMP rules
'./modules/ampHtmlSanitizer'
],
/*
** Axios module configuration
*/
axios: {
// See https://github.com/nuxt-community/axios-module#options
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, { isClient, isServer, isDev, loaders }) {
// Automatically resolve certain extensions
config.resolve.extensions = ['.js', '.vue', 'css', '.scss', '*']
// Run ESLint on save
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/,
options: {
fix: true
}
})
}
}
}
}