将 Webpacker 添加到 Rails 应用程序后的疯狂加载时间 [英] Insane loading time after adding Webpacker to Rails App
问题描述
我运行了 Ruby on Rail 的应用程序,一切正常,直到我安装了 Webpacker.
现在,当我尝试渲染任何页面时,加载时间介于 180 000 毫秒和 400 000 毫秒之间.删除产量会导致完全相同的问题.由于我使用 Turbolinks,因此在我的应用中导航时加载速度很快.
我使用 Ruby 2.6.3,Rails 6.0.0.rc1.
我通过 webpacker 4.0.7 gem 和 Yarn 安装了 Webpack,然后安装了 React.
我运行了 ./bin/webpack-dev-server
然后启动rails server
.
不幸的是,我不知道该做什么或搜索什么......这个问题与此有关:
您是否确保在 config/webpacker.yml
中,compile
设置为 false
在开发中?
开发:<<:*默认编译:假
否则它将按需编译您的资产
I ran a Ruby on Rail's app, and everything was OK until I installed Webpacker.
Now the loading time is between 180 000ms and 400 000ms, when I try to render any page. Removing the yield cause exacly the same problem. As I'm using Turbolinks I have a fast loading time when navigating in my app.
I use Ruby 2.6.3, Rails 6.0.0.rc1.
I installed Webpack via webpacker 4.0.7 gem, and Yarn, and then installed React.
I ran ./bin/webpack-dev-server
then launched rails server
.
Unfortunately, I haven't any clue on what to do or search... This questions is related to this : webpacker: after installation pages in the application began to load for a very long time, which has no answer
EDIT
I uninstalled all, deleted old package.json, and reinstalled only Webpack. My app now needs between 30 and 50 sec to load. I'm wondering, if it's normal that 7 556 736 allocations are loading, related to node_modules folder I guess ?
Did you make sure that, in config/webpacker.yml
, compile
is set to false
in dev?
development:
<<: *default
compile: false
Otherwise it will compile your assets on demand
这篇关于将 Webpacker 添加到 Rails 应用程序后的疯狂加载时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!