mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-17 17:25:50 +10:00
25 lines
662 B
JavaScript
25 lines
662 B
JavaScript
const path = require('path')
|
|
|
|
module.exports = (options, context) => ({
|
|
name: 'default-theme',
|
|
|
|
chainWebpack (config, isServer) {
|
|
const { themeConfig, siteConfig } = context
|
|
|
|
// resolve algolia
|
|
const isAlgoliaSearch = (
|
|
themeConfig.algolia ||
|
|
Object.keys(siteConfig.locales && themeConfig.locales || {})
|
|
.some(base => themeConfig.locales[base].algolia)
|
|
)
|
|
|
|
config.resolve
|
|
.alias
|
|
.set('@default-theme', path.resolve('.'))
|
|
.set('@AlgoliaSearchBox', isAlgoliaSearch
|
|
? path.resolve(__dirname, './src/AlgoliaSearchBox.vue')
|
|
: path.resolve(__dirname, './noopModule.js'))
|
|
.end()
|
|
}
|
|
})
|