-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
executable file
·129 lines (128 loc) · 3.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
122
123
124
125
126
127
128
129
const path = require('path')
const webpack = require('webpack')
const apiConfig = require('./api.config')
const isProdMode = Object.is(process.env.NODE_ENV, 'production')
module.exports = {
srcDir: __dirname,
offline: true,
loading: {
color: '#2196f3'
},
cache: {
max: 100,
maxAge: 1000 * 60 * 15
},
build: {
// analyze: true,
// analyze: {
// analyzerMode: 'static'
// },
publicPath: '/',
// 将重复引用的(第三方/自有)模块添加到vendor.bundle.js
vendor: [
'swiper',
'lodash',
'store',
'axios',
'particles.js',
'element-ui'
],
// 为 JS 和 Vue 文件定制 babel 配置。https://nuxtjs.org/api/configuration-build/#analyze
babel: {
presets: ['es2015', 'stage-0'],
'plugins': [
['component', [{
'libraryName': 'element-ui',
'styleLibraryName': 'theme-default'
},
'transform-async-to-generator',
'transform-runtime'
]],
'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: isProdMode,
env: {
baseUrl: apiConfig.baseUrl,
HOST_URL: apiConfig.baseUrl
},
plugins: [
{ src: '~/plugins/lodash.js' },
{ src: '~/plugins/axios.js' },
{ src: '~/plugins/filters.js' },
{ src: '~/plugins/image-popup.js', ssr: false },
{ src: '~/plugins/vue-empty.js' },
{ src: '~/plugins/vue-loading.js' },
{ src: '~/plugins/vue-comment.js' },
{ src: '~/plugins/vue-piccode.js' },
{ src: '~/plugins/distpicker.js' },
{ src: '~/plugins/element-ui', ssr: true },
{ src: '~/plugins/vue-lazyload.js', ssr: true },
{ src: '~/plugins/swiper.js', ssr: false },
{ src: '~/plugins/baiduanaly.js', ssr: false },
],
head: {
title: '品致家',
titleTemplate: '%s-品致家',
htmlAttrs: {
lang: 'zh'
},
meta: [
{ charset: 'utf-8' },
{ 'http-equiv': 'cleartype', content: 'on' },
{ 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,user-scalable=yes' },
{ name: 'applicable-device', content: 'pc,mobile' },
{ hid: 'keywords', name: 'keywords', content: '乐器商城,乐器电子商务网站,乐器网店,吉他,乐器,中国乐器,民族乐器,小号,长号,黑管,萨克斯,小提琴,乐器培训,乐器租赁,乐器共享' },
{ hid: 'description', name: 'description', content: '乐器之乡电商平台是专业的乐器商城,种类齐全,商品涵盖各类西洋乐器、民族乐器、乐器箱包:吉他、提琴、管乐,同时提供乐器培训平台。' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'author', type: 'text/plain', href: '/humans.txt' }
],
script: [{
type: 'text/javascript',
src: '/scripts/browser.js'
}, {
type: 'text/javascript',
src: '/scripts/jquery.min.js'
}, {
type: 'text/javascript',
src: '/scripts/lightbox.min.js'
}],
noscript: [
{ innerHTML: '您的浏览器不支持JavaScript脚本运行' }
]
},
router: {
middleware: ['ssr-cookie', 'change-page-col'],
linkActiveClass: 'link-active',
scrollBehavior(to, from, savedPosition) {
return { x: 0, y: 0 }
},
extendRoutes(routes) {}
},
css: [
'element-ui/lib/theme-default/index.css',
{ src: '~assets/sass/app.scss', lang: 'sass' },
'swiper/dist/css/swiper.css'
]
}