father icon indicating copy to clipboard operation
father copied to clipboard

TypeError: One and only one of the "port", "server", or "noServer" options must be specified

Open marszhongx opened this issue 4 years ago • 2 comments

run

father doc dev

get image

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()],
  },
};

marszhongx avatar Jul 29 '21 03:07 marszhongx

image

marszhongx avatar Jul 29 '21 03:07 marszhongx

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

PeachScript avatar Jul 29 '21 03:07 PeachScript