Docker + React-Scripts:Slow Bundle.js下载

时间:2018-07-03 15:20:19

标签: javascript reactjs docker create-react-app react-scripts

在一个小型的create-react-app项目中,通过Docker运行时,我的bundle.js文件的下载时间非常糟糕。

react-scripts start在本地运行时,新编译的捆绑包下载时间为1.4秒: enter image description here

通过Docker Compose在Docker上运行时,我看到1.4分钟可以下载新编译的捆绑软件:

enter image description here

要注意的一件事-通过Docker运行时的编译步骤完成得足够快,但是在浏览器中的下载过程是如此缓慢。

在我看来这很疯狂。我有丰富的Docker经验,并且我希望通过Docker运行应用程序时,由于抽象到VM(尤其是前端应用程序),因此运行速度会变慢,但幅度不大。

在Google周围搜索和搜索create-react-app问题并没有为我提供导致该问题的任何线索。

有关我的Docker环境的更多信息-这是前端服务的Docker compose条目:

frontend:
  environment:
    - CHOKIDAR_USEPOLLING=true
  image: node:8
  volumes:
    - ../frontend:/app
  working_dir: /app
  command: "/bin/sh -c 'npm start'" # This runs `react-script start`
  external_links:
    - api
  ports:
    - "3008:3008"

由于我的google-fu失败,正在寻找开始调试的地方。

0 个答案:

没有答案