[全体] app.jsバンドルを分割して閲覧ページのJSペイロードを約84%削減しました#2371
Open
masaton0216 wants to merge 3 commits intomasterfrom
Open
[全体] app.jsバンドルを分割して閲覧ページのJSペイロードを約84%削減しました#2371masaton0216 wants to merge 3 commits intomasterfrom
masaton0216 wants to merge 3 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
public/js/app.jsが 3.3MB(gzip 約1MB)に肥大化しており、全ページで読み込まれるためモバイル環境で描画遅延を引き起こしていました。調査の結果、TinyMCE(~800KB)、tui-image-editor(~500KB)、CodeMirror(~200KB)は編集ページでのみ使用されており、閲覧専用ページには不要でした。また lodash と
window.Vue(Vue2互換)は完全に未使用でした。変更内容
wysiwyg.jsとして分離し、wysiwyg.blade.phpで条件付き読み込みcodemirror.jsとして分離し、codemirror.blade.phpで条件付き読み込みwindow._)と Vue2互換のwindow.Vueを削除バンドルサイズの変化
app.js(削減後)wysiwyg.js(新規)codemirror.js(新規)閲覧専用ページ: 3.3MB → 532KB(約84%削減)
レビュー完了希望日
急ぎません
関連Pull requests/Issues
#2370
参考
window.*グローバルとしてBladeテンプレートから同期的に参照されるため、動的import()ではなく<script>タグの条件付き追加で対応)DB変更の有無
無し
チェックリスト
手動テストプラン
ビルド確認
npm run prodでエラーなくビルドが完了することpublic/js/にapp.js、wysiwyg.js、codemirror.jsが生成されることpublic/mix-manifest.jsonに3つのJSファイルが含まれること閲覧ページ(app.js のみ読み込み)
WYSIWYGエディタ(wysiwyg.js 読み込み)
CodeMirror(codemirror.js 読み込み)