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

bug: 不能和create-react-app配套使用 #121

Closed
builden opened this issue Mar 12, 2020 · 10 comments · Fixed by #163
Closed

bug: 不能和create-react-app配套使用 #121

builden opened this issue Mar 12, 2020 · 10 comments · Fixed by #163
Assignees
Labels
bug Something isn't working

Comments

@builden
Copy link

builden commented Mar 12, 2020

Versions

  • dumi: 0.1.0
  • node: 12.13.1
  • npm: 6.12.1
  • OS: Win7
  • Browser:

Steps to reproduce

  1. 使用create-react-app创建一个全新的工程
  2. yarn add dumi -D 安装dumi
  3. yarn dumi dev 执行,打开页面
  4. 出现错误提示:URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'

What is Expected?

What is actually happening?

@builden builden added the bug Something isn't working label Mar 12, 2020
@fi3ework
Copy link

fi3ework commented Apr 3, 2020

Guess this related to umijs/umi#1959

@builden
Copy link
Author

builden commented Apr 3, 2020

怎么解决呢?文档中没看到有修改这个配置项的说明

@fi3ework
Copy link

fi3ework commented Apr 3, 2020

@PeachScript 尝试在配置路由中加了 document,但是不起作用 https://umijs.org/zh/guide/html-template.html#%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF 而且只有默认的根路径会打错模板,其他路径没问题。

@PeachScript
Copy link
Member

@xiaohuoni 这个场景配置 document.ejs 是正解么

@PeachScript
Copy link
Member

在 dumi (Umi) 的约定中,public 会作为默认拷贝到 dist 的文件夹,和 cra 的文件夹冲突了,我们只能二选一;如果选择保留 cra 的逻辑,可使用 config.chainWebpack 去掉 dumi 的逻辑:

chainWebpack(memo) {
  memo.plugins.delete('copy');
}

如果 dumi 和 cra 的约定都希望保留,可以如法炮制把上述 dumi 的 copy 的规则修改成拷贝类似 static 目录。

@xiaohuoni
Copy link
Member

@PeachScript 还用不惯github新的issues,如果有@我,可以直接钉钉找我下。

@builden
Copy link
Author

builden commented Apr 29, 2020

@xiaohuoni
使用PeachScript的方法,无效。试用过
meme.plugins.delete('copy')
memo.plugins.store.delete('copy')
都不行,会报另一种错误

// .umirc.ts
import { defineConfig } from 'dumi';

export default defineConfig({
  title: 'dumi',
  mode: 'site', // site | doc
  chainWebpack(memo) {
    memo.plugins.delete('copy');
    memo.plugins.store.delete('copy');
  },
});

image

@builden
Copy link
Author

builden commented May 10, 2020

@xiaohuoni 使用这种方式,dumi/docs下的md文件,无法引用src目录下的jsx组件

Module parse failed: Unexpected token (4:9)

@xiaohuoni
Copy link
Member

@builden #161 这里一起讨论

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants