-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnuxt.config.js
185 lines (158 loc) · 4.77 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
const path = require('path')
const MongoClient = require('mongodb').MongoClient
const isSPA = process.argv.includes('--spa')
const isDev = process.env.npm_lifecycle_event == 'dev'
module.exports = {
env: {
isSPA,
PROD: process.env.PROD || false,
API_URL: process.env.API_URL || 'https://api.dtrip.app/rest',
API_QL_URL: process.env.API_QL_URL || 'http://localhost:5000/graphql',
BACKEND_API: process.env.BACKEND_API || 'http://127.0.0.1:8000/api/',
BASE_URL: process.env.BASE_URL || 'http://localhost:3000/',
},
/*
** Headers of the page
*/
head: {
title: 'DTrip: Write about travel, earn, travel.',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description',
name: 'description',
content: 'DTrip is global tourist knowledge base, social network and a new generation corporation. You can write articles about your travels, interesting places and get paid for it.'
},
// { property: 'og:image', content: '' },
{ name: "msapplication-TileColor", content: "#da532c"},
{ name: "theme-color", content: "#ffffff"},
],
link: [
// TODO Logo here
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico'},
],
},
css: [
'@/assets/css/bootstrap.css',
'element-ui/lib/theme-chalk/index.css',
//'@/assets/css/grid.css', // TODO Remove bootstrap
'@/assets/css/bootstrap-utilities.css',
'vue-js-modal/dist/styles.css', // FIXME not working by default
'@/assets/css/main.css'
],
modules: [
'@nuxtjs/apollo',
'@nuxtjs/sentry',
'nuxt-device-detect',
'@nuxtjs/font-awesome',
'@nuxtjs/sitemap',
'vue-github-buttons/nuxt',
// Google AdSense
['@nuxtjs/google-adsense', {
id: 'ca-pub-7627079610692780'
}]
],
apollo: {
clientConfigs: {
default: {
httpEndpoint: process.env.API_QL_URL || 'http://localhost:5000/graphql',
},
}
},
plugins: [
// Плагин в котором лежат все вызовы при запуске клиента
{ssr: false, src: '~/plugins/startapp.js'},
{ssr: false, src: '~/plugins/localStorage.js'},
{ssr: false, src: '~/plugins/vuelidate.js'},
{ssr: false, src: '~/plugins/vue-notification.js'},
{ssr: false, src: '~/plugins/vue-clipboard2.js'},
{ssr: false, src: '~/plugins/infiniteload.js'},
// {ssr: false, src: '~/plugins/vue-tel-imput.js'},
'~/plugins/vue-js-modal',
'~/plugins/vue-google-maps',
'~/plugins/filters.js',
'~/plugins/vuex-router-sync.js',
'~/plugins/elements.js',
'~/plugins/element-ui.js',
'~/plugins/steemconnect'
],
/*
** Customize the progress bar color
*/
loading: { color: '#3B8070' },
/*
** Build configuration
*/
build: {
cssSourceMap: false,
/*
** 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)/
})
}
if (isSPA) {
config.output.publicPath = './_nuxt/'
}
},
},
router: {
mode: isSPA ? 'hash' : 'history',
linkActiveClass: 'active',
extendRoutes(routes, resolve) {
routes.push({
name: 'account',
path: '/@:account',
component: resolve(__dirname, 'pages/AccountPage.vue')
})
routes.push({
name: 'post',
path: '/@:author/:permlink',
component: resolve(__dirname, 'components/post/PostSinglePage.vue')
})
}
},
loading: {
color: 'white',
height: '3px'
},
loadingIndicator: {
name: 'fading-circle',
color: '#409EFF',
background: 'white'
},
cache: {
maxAge: 1000 * 60 * 2
},
//sitemap: isSPA ? {
// //cacheTime: 1000 * 60 * 15,
// gzip: true,
// exclude: [
// '/errors/**'
// ],
// async routes() {
// const client = await MongoClient.connect('mongodb://db:27017', { useNewUrlParser: true })
// const db = client.db('dtrip_steem')
// let [posts, authors] = await Promise.all([
// db.collection("post_model").find({'depth': 0})
// .project({author: true, permlink: true, last_update: true}).toArray(),
// //db.collection("account_object").find({'json_metadata.dtripProfile': {'$exists': true}})
// // .project({name: true}).toArray()
// ])
// return [
// //...authors.map(a => `/@${a.name}`),
// ...posts.map(p => ({ url: `/@${p.author}/${p.permlink}`, lastmodISO: p.last_update.toISOString()})),
// ]
// }
//} : undefined,
sentry: {
dsn: process.env.SENTRY_DSN || 'https://e00d35317557416b9ef3e69b7df52b50@sentry.io/1306350',
disabled: isDev
}
}