-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnuxt.config.js
121 lines (121 loc) · 2.88 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
export default {
mode: 'universal',
env: {
authURL: process.env.NODE_ENV === 'dev' ? '//localhost:7000' : '//login.baldbear.cn'
},
head: {
title: '秃头熊的个人博客',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '秃头熊的前端知识库' }
],
link: [{ rel: 'icon', type: 'image/png', href: '/favicon.png' }]
},
router: {
middleware: '404'
},
loading: false,
css: ['element-ui/lib/theme-chalk/display.css', 'mavon-editor/dist/css/index.css'],
plugins: [
'@/api/note.js',
'@/api/common.js',
'@/api/life.js',
'@/api/user.js',
'@/api/message.js',
'@/plugins/element-ui',
'@/plugins/interceptor.js',
'@/plugins/common.js',
{ src: '@/plugins/mavon-editor', mode: 'client' },
{ src: '@/plugins/vue-lazyload', mode: 'client' }
],
buildModules: [
'@nuxtjs/tailwindcss'
// '@aceforth/nuxt-optimized-images'
],
// optimizedImages: {
// optimizeImages: true
// },
modules: ['@nuxtjs/axios', 'cookie-universal-nuxt', 'nuxt-precompress'],
nuxtPrecompress: {
gzip: {
enabled: true,
filename: '[path].gz[query]',
threshold: 10240,
minRatio: 0.8,
compressionOptions: { level: 9 },
deleteOriginalAssets: true
},
brotli: {
enabled: false,
filename: '[path].br[query]',
compressionOptions: { level: 11 },
threshold: 10240,
minRatio: 0.8
},
enabled: true,
report: false,
test: /\.(js|css|html|txt|xml)$/,
middleware: {
enabled: true,
enabledStatic: true,
encodingsPriority: ['br', 'gzip']
}
},
axios: {
proxy: true,
prefix: '/api'
},
proxy: {
'/api': {
target: 'http://localhost:3008',
pathRewrite: { '^/api': '' }
}
},
build: {
transpile: [/^element-ui/],
babel: {
plugins: [
[
'component',
{
libraryName: 'element-ui',
styleLibraryName: 'theme-chalk'
}
]
]
},
optimization: {
splitChunks: {
chunks: 'all',
automaticNameDelimiter: '.',
cacheGroups: {
'element-ui': {
test: /node_modules[\\/]element-ui/,
chunks: 'all',
priority: 20,
name: true
},
'mavon-editor': {
test: /node_modules[\\/]mavon-editor/,
chunks: 'all',
priority: 20,
name: true
}
}
}
},
extend(config, ctx) {
// config.module.rules.push({
// test: /\.(png|jpe?g|gif|svg)/i,
// loader: 'url-loader',
// options: {
// limit: 1000,
// name: 'img/[name].[hash].[ext]',
// esModule: false
// }
// })
config.devtool = false
}
}
}