forked from surmon-china/surmon.me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
executable file
·145 lines (144 loc) · 4.53 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
const path = require('path')
const webpack = require('webpack')
const apiConfig = require('./api.config')
module.exports = {
cache: {
max: 20,
maxAge: 600000
},
// offline: true,
loading: { color: '#2196f3' },
build: {
// analyze: true,
// analyze: {
// analyzerMode: 'static'
// },
// 对webpack的扩展
extend(webpackConfig, { isDev, isClient, isServer }) {
/*
webpackConfig.resolve.alias['~utils'] = path.join(__dirname, 'utils')
webpackConfig.resolve.alias['~static'] = path.join(__dirname, 'static')
webpackConfig.resolve.alias['~filters'] = path.join(__dirname, 'filters')
webpackConfig.resolve.alias['~services'] = path.join(__dirname, 'services')
console.log(webpackConfig.module.rules)
// webpackConfig.module.rules.push({
// test: /\.scss$/,
// use: ['vue-style-loader?sourceMap', 'css-loader?sourceMap', 'sass-loader']
// })
*/
},
plugins: [
// new webpack.ContextReplacementPlugin(
// /highlight\.js\/lib\/languages$/,
// new RegExp(`^./(${['javascript', 'python', 'bash', 'css', 'html', 'php', 'go', 'less', 'json', 'scss', 'nginx', 'shell', 'sql', 'stylus', 'typescript'].join('|')})$`),
// ),
],
// 将重复引用的(第三方/自有)模块添加到vendor.bundle.js
vendor: [
'axios',
'howler',
'swiper',
'marked',
'gravatar',
'clipboard',
'particles.js',
'simplewebrtc',
'socket.io-client'
],
// 为JS和Vue文件定制babel配置。https://nuxtjs.org/api/configuration-build/#analyze
babel: {
presets: ['es2015', 'stage-2'],
plugins: [
'transform-async-to-generator',
'transform-runtime'
],
comments: true
},
// Run ESLINT on save
/*
extend (config, ctx) {
if (ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
*/
},
dev: (process.env.NODE_ENV !== 'production'),
env: {
baseUrl: apiConfig.baseUrl,
HOST_URL: apiConfig.socketHost
},
plugins: [
{ src: '~/plugins/axios.js' },
{ src: '~/plugins/howler.js' },
{ src: '~/plugins/filters.js' },
{ src: '~/plugins/marked.js' },
{ src: '~/plugins/gravatar.js' },
{ src: '~/plugins/highlight.js' },
{ src: '~/plugins/clipboard.js' },
{ src: '~/plugins/ga.js', ssr: false },
{ src: '~/plugins/clmtrackr.js', ssr: false },
{ src: '~/plugins/emoji-233333.js', ssr: false },
{ src: '~/plugins/image-popup.js', ssr: false },
{ src: '~/plugins/copy-right.js', ssr: false },
{ src: '~/plugins/particles.js', ssr: false },
{ src: '~/plugins/swiper.js', ssr: false },
{ src: '~/plugins/vue-empty.js' },
{ src: '~/plugins/vue-loading.js' },
{ src: '~/plugins/vue-comment.js' }
],
head: {
title: 'Surmon.me - Talk is cheap. Show me the code',
titleTemplate: '%s | Surmon.me',
htmlAttrs: {
xmlns: 'http://www.w3.org/1999/xhtml',
lang: 'zh'
},
meta: [
{ charset: 'utf-8' },
{ 'http-equiv': 'cleartype', content: 'on' },
{ name: 'author', content: 'surmon@foxmail.com' },
{ name: 'MobileOptimized', content: '320' },
{ name: 'HandheldFriendly', content: 'True' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, user-scalable=no' },
{ hid: 'keywords', name: 'keywords', content: 'surmon,马赐崇,司马萌,Vue教程,前端技术开发,javascript技术' },
{ hid: 'description', name: 'description', content: '凡心所向 素履所往 生如逆旅 一苇以航' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'author', type: 'text/plain', href: '/humans.txt' }
],
script: [
{
// async: 'async',
// defer: 'defer',
// type: 'text/javascript',
// src: '/scripts/clmtrackr.js'
// innerHTML: ``
}
],
// __dangerouslyDisableSanitizers: ['script'],
noscript: [
{ innerHTML: 'This website requires JavaScript.' }
]
},
router: {
middleware: ['change-page-col'],
linkActiveClass: 'link-active',
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
},
extendRoutes(routes) {}
},
css: [
'swiper/dist/css/swiper.css',
'highlight.js/styles/ocean.css',
{ src: '~assets/sass/app.scss', lang: 'sass' }
]
}