father
father copied to clipboard
TypeError: One and only one of the "port", "server", or "noServer" options must be specified
run
father doc dev
get

fatherrc.js
const path = require('path');
const cacheDirectory = path.join(__dirname, './node_modules/.cache');
const MDXMaterialInfoPlugin = require('./build/md-loader-read-material-info.js');
const fs = require('fs');
const globby = require('glob');
const mdxMaterialInfoPlugin = new MDXMaterialInfoPlugin();
const resolve = (p) => path.resolve(__dirname, p);
module.exports = {
doc: {
// src: './packages/',
port: 8000,
files: [
'./packages/*/!(node_modules)/**/*.{md,markdown,mdx}',
'./docs/**/*.{md,markdown,mdx}',
],
hashRouter: true,
propsParser: false,
codeSandbox: false,
clearConsole: false,
typescript: false,
native: false,
sourcemaps: false,
ignore: [],
onCreateWebpackChain(chain) {
chain.resolve.extensions.add('.vue');
/* 配置vue-loader */
chain.module
.rule('vue')
.test(/\.vue$/)
.use('cache-loader')
.loader('cache-loader')
.options({
cacheDirectory,
})
.end()
.use('vue-loader')
.loader('vue-loader')
.options({
compilerOptions: {
whitespace: 'condense',
},
cacheDirectory,
});
chain.plugin('vue-loader').use(require('vue-loader').VueLoaderPlugin);
// require('vue/dist/vue.esm')
chain.resolve.alias.set(
'vue$',
path.resolve(__dirname, './node_modules/vue/dist/vue.esm.js')
);
globby
.sync(resolve('./packages/**/material.json'))
.forEach((materialJsonPath) => {
const materialInfo = JSON.parse(fs.readFileSync(materialJsonPath));
chain.resolve.alias.set(
`@/materials/${materialInfo.key}`,
path.dirname(materialJsonPath)
);
});
},
theme: 'docz-theme-umiv',
hastPlugins: [require('rehype-plugin-umiv')],
mdPlugins: [mdxMaterialInfoPlugin.mdPlugin()],
plugins: [mdxMaterialInfoPlugin.doczPlugin()],
},
};

father doc 命令不再维护了,如果想用 docz 可以安装最新版的 docz + father-build,但更推荐使用 dumi 作为文档工具:https://github.com/umijs/father/issues/241