Fix lỗi [Webpacker] Everything's up-to-date. Nothing to do
Lượt xem: 1100
Fix lỗi [Webpacker] Everything's up-to-date. Nothing to do
Dự án gần đây mình có sử dụng docker-compose để chạy ruby on rails và webpacker. Mỗi khi ứng dụng Ruby on Rails chạy thì thường ghi log ở docker log
Started GET "/" for ::1 at 2019-12-23 09:53:34 +1100
Processing by PagesController#index as HTML
Rendering layouts/application.html.slim
Rendering pages/index.html.slim within layouts/application
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
[Webpacker] Everything's up-to-date. Nothing to do
Rendered pages/index.html.slim within layouts/application (Duration: 716.1ms | Allocations: 131629)
Rendered layouts/application.html.slim (Duration: 1632.2ms | Allocations: 251011)
Completed 200 OK in 1635ms (Views: 1632.1ms | ActiveRecord: 1.2ms | Allocations: 252079)
Thực ra nó ghi lỗi nay mình cũng không khó chịu lắm. Tuy nhiên mỗi lần reload lại page hoặc restart lại docker page vào rất chậm. Có khi tới vài phút mới vào được page. Đây có lẽ là vấn đề khó chịu nhất. Nó ảnh hưởng tới tiến độ dự án cực kỳ lớn. Cá biệt có lần mình load tận 10 phút mới vào được page. Chưa kể việc mình thường xuyên sửa scss hay js ở webpacker nên thường phải reload lại docker hoặc sử dụng watch mà load mãi không vào được page. Nên mình nghĩ đây có thể là vấn đề việc compiler của webpacker. Qua quá trình tìm hiểu mình đã khắc phục được và việc reload lại page chỉ mất vài giây. Nếu bạn nào gặp phải tình trạng như của mình thì hãy thử. thêm file webpacker.rb với nội dung sau vào folder config/initializers nhé
#config/initializers/webpacker.rb
module Webpacker
module OneTimeCompiler
def compile
@compiled ||= super
end
end
Compiler.prepend(OneTimeCompiler) if Webpacker.config.compile?
end
Chúc các bạn thành công!