forked from Matataki-io/matataki-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
208 lines (199 loc) · 6.95 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import path from 'path'
import webpack from 'webpack'
import SpriteLoaderPlugin from 'svg-sprite-loader/plugin'
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import i18n from './plugins/i18n'
import ENV from './env'
function resolve(dir) {
return path.join(__dirname, dir)
}
const NODE_ENV = process.env.NODE_ENV
console.log(NODE_ENV)
function cdnPublicPath (env) {
const list = {
'development': '/_nuxt/',
'testing': 'https://cdntest.frontenduse.top',
'release': 'https://cdntest.frontenduse.top/release',
'production': 'https://cdn.frontenduse.top',
}
return list[env] || '/_nuxt/'
}
export default {
/*
** Headers of the page
*/
head: {
// title: process.env.npm_package_name || '',
title: '瞬MATATAKI',
meta: [
{ hid: 'robots', name: 'robots', property: 'robots', content: 'index,follow' },
{ hid: 'copyright', name: 'copyright', property: 'copyright', content: 'Copyright © 2018-2019 ANDOROMEDA TECH.ltd' },
{ hid: 'description', name: 'description', content: '瞬MATATAKI是一个永久存储和版权确权的内容平台,通过IPFS协议保障内容的永久可访问和确权信息可查询。使用了Fan票来激励创作者、探索者、布道者共建未来的超级知识链接网络。' },
{ hid: 'keywords', name: 'keywords', content: '岛娘,小岛美奈子,唐飞虎,仙女座科技,瞬MATATAKI,智能公告牌,智能投资,裂变营销,价值投资,区块链,比特币,以太坊,去中心化社交,去中心化商店,去中心化,DApp,EOS' },
/* <!-- Meta for Twitter Card --> */
{ hid: 'twitter:card', name: 'twitter:card', property: 'twitter:card', content: 'summary' },
{ hid: 'twitter:site', name: 'twitter:site', property: 'twitter:site', content: '瞬MATATAKI—发布瞬间,灵感永存' },
{ hid: 'twitter:title', property: 'twitter:title', content: '瞬MATATAKI—发布瞬间,灵感永存' },
{ hid: 'twitter:image', name: 'twitter:image', property: 'twitter:image', content: 'https://ssimg.frontenduse.top/avatar/2019/08/30/c1d6ae7ed4e6102cb45d0a8f656d5569.png' },
{ hid: 'twitter:description', name: 'description', property: 'twitter:description', content: '瞬MATATAKI是一个永久存储和版权确权的内容平台,通过IPFS协议保障内容的永久可访问和确权信息可查询。使用了Fan票来激励创作者、探索者、布道者共建未来的超级知识链接网络。' },
/* <!-- Meta for OpenGraph --> */
{ hid: 'og:type', name: 'og:type', property: 'og:type', content: 'website' },
{ hid: 'og:site_name', name: 'og:site_name', property: 'og:site_name', content: '瞬MATATAKI—发布瞬间,灵感永存' },
{ hid: 'og:title', property: 'og:title', content: '瞬MATATAKI—发布瞬间,灵感永存' },
{ hid: 'og:image', name: 'og:image', property: 'og:image', content: 'https://ssimg.frontenduse.top/avatar/2019/08/30/c1d6ae7ed4e6102cb45d0a8f656d5569.png' },
{ hid: 'og:description', name: 'description', property: 'og:description', content: '瞬MATATAKI是一个永久存储和版权确权的内容平台,通过IPFS协议保障内容的永久可访问和确权信息可查询。使用了Fan票来激励创作者、探索者、布道者共建未来的超级知识链接网络。' },
{ hid: 'og:type', name: 'og:type', property: 'og:type', content: 'article' }
/* end */
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
],
script: []
},
/*
** Customize the progress-bar color
*/
loading: {
color: '#542DE0'
},
/*
** Global CSS
*/
css: [
'./assets/css/index.less'
],
router: {
// middleware: ''
},
/*
** Plugins to load before mounting the App
*/
plugins: [
'@/plugins/axios',
'@/plugins/combined-inject.js',
'@/plugins/vue_plugins.js',
'@/plugins/vue_components.js',
// '~/plugins/i18n.js',
'@/plugins/vue_directive.js',
'@/plugins/vue_lazyload.js',
{ src: '@/plugins/broadcastchannel.js', mode: 'client' },
{ src: '@/plugins/router.js', mode: 'client', ssr: false },
{ src: '@/plugins/element-ui', ssr: true },
{ src: '@/plugins/vant_ui', ssr: true },
{ src: '@/plugins/nossr', ssr: false },
{ src: '@/plugins/vue-mavon-editor', ssr: false },
{ src: '@/plugins/vue_scroll_reveal.js', ssr: false },
// { src: '~/plugins/fundebug.js', ssr: false },
{ src: '@/plugins/sentry.js', ssr: false },
{ src: '@/plugins/v-viewer.js', ssr: false },
{ src: '@/plugins/vue_echarts.js', ssr: false }
],
generate: {
// routes: [
// '/', '/en'
// ]
},
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/eslint-module',
'@nuxtjs/style-resources',
'@nuxtjs/pwa',
['nuxt-i18n', i18n]
],
styleResources: {
less: './assets/css/global.less'
},
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
/*
** Build configuration
*/
build: {
publicPath: cdnPublicPath(NODE_ENV),
// analyze: true,
optimization: {
splitChunks: {
cacheGroups: {
editor: {
test: /node_modules[\\/]@matataki\/editor/,
chunks: 'all',
priority: 20,
name: true
},
elementui: {
test: /node_modules[\\/]element-ui/,
chunks: 'all',
priority: 20,
name: true
},
echarts: {
test: /node_modules[\\/]echarts/,
chunks: 'all',
priority: 20,
name: true
},
}
}
},
cache: true,
parallel: true,
// CSS提取
// extractCSS: true,
/*
** You can extend webpack config here
*/
extend(config, { isDev, isClient }) {
if (isDev) {
config.devtool = isClient ? 'source-map' : 'inline-source-map'
}
// set svg-sprite-loader
if (isClient) {
config.module.rules.forEach((rule) => { // 移除默认处理svg的配置
if (~rule.test.source.indexOf('|svg')) {
rule.exclude = [resolve('icons/svg')]
}
})
config.module.rules.push(
{ // 使用svg
test: /\.svg$/,
loader: 'svg-sprite-loader',
include: [resolve('icons/svg')], // include => 只处理指定的文件夹下的文件
options: {
symbolId: 'icon-[name]'
}
})
// console.log(config.module.rules)
// set svg-sprite-loader end
}
},
plugins: [
new SpriteLoaderPlugin(), // set svg-sprite-loader
new webpack.ContextReplacementPlugin(
/moment[/\\]locale$/,
/zh-cn/
)
// new BundleAnalyzerPlugin()
],
},
server: {
port: 8080, // default: 3000
host: '0.0.0.0'
},
pwa: {
manifest: {
name: 'Matataki',
gcm_sender_id: '1011435306795'
},
workbox: {
}
},
env: ENV[process.env.NODE_ENV]
}