Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zomixi opened this issue Jul 29, 2021 · 2 comments
Labels

Comments

@zomixi
Copy link

zomixi commented Jul 29, 2021

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()],
  },
};
@zomixi
Copy link
Author

zomixi commented Jul 29, 2021

image

@PeachScript
Copy link
Member

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

@PeachScript PeachScript closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants