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

dll 与 devServer.before 冲突 #2161

Closed
coppyC opened this issue Mar 23, 2019 · 2 comments
Closed

dll 与 devServer.before 冲突 #2161

coppyC opened this issue Mar 23, 2019 · 2 comments

Comments

@coppyC
Copy link

coppyC commented Mar 23, 2019

image
请求的 umi.dll.js 文件内容变成 这个html 了

<!DOCTYPE html><html><head>

<link rel="stylesheet" href="/umi.css">

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

  <title>管理端</title>

<script>
  window.routerBase = "./";
</script>
<script src="/umi.dll.js"></script>
</head>
<body>

<div id="root"></div>

<script src="/umi.js"></script>


</body></html> 

但是我在node_modules 找到的 umi.dll.js 文件是正常的,不是这个html文件

How To Reproduce

Steps to reproduce the behavior:

  1. 在 .umirc.ts 中开启 dll
  2. 在 .umirc.ts 中添加
  devServer: {
    before(app, server) {
      app.get('/xxx/dev/', function(req, res) {
        res.json({ custom: 'response' })
      })
    }
  }
  1. 出现上面错误
  2. 关闭 dll 或 删除 devServer.before 则可以正常运行

Expected behavior

  1. 同时开启 dll 和 devServer.before 不会出错

Context

  • Umi Version: 2.6.1
  • Node Version: 10.15.1
  • Platform: os x
@sorrycc
Copy link
Member

sorrycc commented Mar 26, 2019

mock 数据的话,在 mock 文件夹里配吧。

@coppyC
Copy link
Author

coppyC commented Mar 26, 2019

nice!
我一开始以为 mock 只能写数据
没想到居然能支持自定义函数,而且还帮我做了body parse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants