toshizou-Rails

Rails5以降になって表示された警告

警告が出て毎回焦るのは嫌なので備忘録としてメモ。

 

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (xxx KiB). This can impact web performance.
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (xxx KiB). This can impact web performance.
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application

上の三つの文言は全てwebpack関連の警告です。

rake asset:precompile コマンドを実行した最後の方にログとして表示されました。

上から順に翻訳すると下記のようになります。

  • アセットサイズ制限の警告:次のアセットは、推奨サイズ制限(xxx KiB)を超えています。 これはWebのパフォーマンスに影響を与える可能性があります。
  • エントリポイントサイズ制限の警告:次のエントリポイントの合計アセットサイズが推奨制限(xxx KiB)を超えています。 これはWebのパフォーマンスに影響を与える可能性があります。
  • webpackのパフォーマンスに関する推奨事項の警告:
    import()またはrequire.ensureを使用してバンドルのサイズを制限し、アプリケーションの一部を遅延ロードすることができます。

解決法はまだ探せていないのでわかったら後で追記します。