docs_vue2/nuxt.config.js

110 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-08-13 11:47:56 +08:00
const path = require('path')
function resolve (p) {
return path.resolve(__dirname, p)
}
function appendLoader (config, loader) {
config.module.rules.push(loader)
}
module.exports = {
target: 'static',
telemetry: false,
2020-08-13 11:47:56 +08:00
/**
* Headers of the page
*/
head: {
title: 'VEUI',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: 'Website for VEUI: an enterprise component library for Vue.js.'
},
{
name: 'theme-color', content: '#0052cc'
2020-08-13 11:47:56 +08:00
}
],
link: [
{ rel: 'shortcut icon', href: 'https://www.baidu.com/favicon.ico' }
2020-08-13 11:47:56 +08:00
]
},
/**
* Customize the progress bar color
*/
2021-07-19 20:12:14 +08:00
loading: { color: '#0052cc' },
2020-08-13 11:47:56 +08:00
pageTransition: {
css: false
},
css: ['veui-theme-dls/common.less', '@/assets/styles/global.styl', 'veui-theme-dls/'],
2020-08-13 11:47:56 +08:00
plugins: [
{ src: '~plugins/i18n.js' },
{ src: '~plugins/l10n.js' },
{ src: '~plugins/target.js', ssr: false },
{ src: '~plugins/hm.js', ssr: false }
2020-08-13 11:47:56 +08:00
],
/**
* Build configuration
*/
build: {
2020-12-23 11:20:09 +08:00
transpile: ['veui', 'vue-awesome', 'resize-detector', 'less-plugin-dls', 'dls-graphics'],
2020-08-13 11:47:56 +08:00
babel: {
plugins: ['veui', 'lodash']
},
loaders: {
vue: {
compilerOptions: {
whitespace: 'condense'
}
},
stylus: {
'include css': true
},
less: {
javascriptEnabled: true
}
},
extend (config) {
/**
* veui-loader
*/
appendLoader(config, {
enforce: 'pre',
test: /\.vue$/,
loader: 'veui-loader',
options: {
locale: ['zh-Hans', 'en-US'],
modules: [
{
package: 'veui-theme-dls',
fileName: '{module}.js',
transform: false
}
]
},
include: [resolve('pages'), resolve('node_modules/veui')]
})
appendLoader(config, {
test: /\.js$/,
include: [resolve('node_modules/focus-visible')],
loader: 'short-circuit-loader',
options: {
expr: "process.env.VUE_ENV === 'server'"
}
})
}
}
}