dumi icon indicating copy to clipboard operation
dumi copied to clipboard

访问的路由如何添加 .html suffix?

Open NoahStepheno opened this issue 2 years ago • 2 comments

Question

我的文档产物是上传到OSS上,静态托管,如果访问地址没有.html则访问不了,配置 exportStatic 后,生成了多个HTML,但导航跳转目标地址没有 .html,但如果实际访问 .html 文件也访问不到路由,umi2.0(suffix 不知道是不是做这个),但切到dumi后,文档没有了,配置也不会生效,请问如何

Sample Code

import { defineConfig } from 'dumi';

const isProduction = process.env.NODE_ENV === 'production';

const PREFIX = '/dist/';

export default defineConfig({
  mfsu: false,
  outputPath: 'dist',
  base: PREFIX,
  publicPath: isProduction ? PREFIX : '/',
  apiParser: {},
  resolve: {
    atomDirs: [
      {
        type: 'component',
        dir: 'src/components',
      },
    ],
    entryFile: './src/index.ts',
  },
  themeConfig: {
    // name: 'CC',
    // deviceWidth: 375,
    sidebar: {
      '/components': [
        {
          children: [
            {
              title: 'QuestionInput',
              link: '/components/question-input',
            },
          ],
        },
      ],
    },
    nav: [
      {
        title: 'chat-page',
        link: '/chat-page',
      },
      {
        title: 'component',
        link: '/components/question-input',
      },
    ],
  },
  styles: [`div.dumi-mobile-demo-layout { padding: 0 }`],
});

NoahStepheno avatar May 30 '23 06:05 NoahStepheno

Umi 4 还没有实现 exportStatic.htmlSuffix,有兴趣欢迎 PR,相关代码位置:https://github.com/umijs/umi/blob/fcfaa810bfbc914c9e2f3f2d9cefb393d738d2ab/packages/preset-umi/src/features/exportStatic/exportStatic.ts

PeachScript avatar May 30 '23 08:05 PeachScript

Hello @NoahStepheno. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please be sure to fill in the default template in the Pull Request, provide changelog/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!

你好 @NoahStepheno,我们完全同意你的提议/反馈,欢迎直接在此仓库创建一个 Pull Request 来解决这个问题。请务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。

github-actions[bot] avatar May 30 '23 08:05 github-actions[bot]