docs_vue2/nuxt.config.js

153 lines
3.2 KiB
JavaScript
Raw Normal View History

2020-08-13 11:47:56 +08:00
const path = require('path')
const MonacoEditorPlugin = require('monaco-editor-webpack-plugin')
2020-08-13 11:47:56 +08:00
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',
2022-05-05 15:52:28 +08:00
htmlAttrs: {
lang: 'zh-Hans'
},
2020-08-13 11:47:56 +08:00
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: [
2022-02-23 22:07:26 +08:00
{ src: '~plugins/hm.js', ssr: false },
2020-08-13 11:47:56 +08:00
{ src: '~plugins/i18n.js' },
{ src: '~plugins/l10n.js' },
{ src: '~plugins/target.js', ssr: false },
2022-02-23 22:07:26 +08:00
{ src: '~plugins/prism.js', ssr: false }
2020-08-13 11:47:56 +08:00
],
/**
* Build configuration
*/
build: {
2021-12-23 10:12:49 +08:00
cache: true,
parallel: true,
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: {
2021-11-20 13:22:48 +08:00
plugins: ['veui']
2020-08-13 11:47:56 +08:00
},
loaders: {
vue: {
compilerOptions: {
whitespace: 'condense'
}
},
stylus: {
'include css': true
},
less: {
javascriptEnabled: true
}
},
plugins: [
new MonacoEditorPlugin({
languages: ['javascript', 'css', 'html', 'typescript']
})
],
2020-08-13 11:47:56 +08:00
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'"
}
})
2021-11-20 13:22:48 +08:00
config.resolve.alias.vue$ = 'vue/dist/vue.esm.js'
config.resolve.alias['vue-monaco'] = '@justfork/vue-monaco'
2021-11-20 13:22:48 +08:00
},
optimization: {
splitChunks: {
cacheGroups: {
veui: {
test: /node_modules[\\/]veui/,
chunks: 'all',
priority: 20,
name: true
},
'veui-theme-dls-icons': {
test: /node_modules[\\/]veui-theme-dls-icons/,
chunks: 'all',
priority: 20,
name: true
},
'vue-live': {
test: /node_modules[\\/]vue-live/,
chunks: 'all',
priority: 20,
name: true
}
}
}
2020-08-13 11:47:56 +08:00
}
}
}