Overview
package.json includes Monaco Editor (@monaco-editor/react), video.js, and ethers as top-level dependencies imported statically throughout the application. These libraries add 400KB+ to the initial JavaScript bundle, increasing Time to Interactive for all users, including those who never visit the editor, video, or Web3 pages.
Specifications
Features:
- Monaco Editor, video.js, and ethers are loaded only when the pages that need them are visited
- Initial bundle size is reduced by at least 200KB gzipped
Tasks:
- Wrap Monaco Editor import with
next/dynamic: const MonacoEditor = dynamic(() => import('@monaco-editor/react'), { ssr: false })
- Apply the same pattern to video.js player component and ethers.js imports in client components
- Run
next build and compare bundle analysis before and after using ANALYZE=true
Impacted Files:
- Any component importing
@monaco-editor/react, video.js, or ethers directly
next.config.ts
Acceptance Criteria
- Bundle analysis shows Monaco, video.js, and ethers in separate async chunks
- Initial JS bundle is reduced by at least 200KB gzipped
- Lazy-loaded components still function correctly after the dynamic import resolves
Overview
package.jsonincludes Monaco Editor (@monaco-editor/react),video.js, andethersas top-level dependencies imported statically throughout the application. These libraries add 400KB+ to the initial JavaScript bundle, increasing Time to Interactive for all users, including those who never visit the editor, video, or Web3 pages.Specifications
Features:
Tasks:
next/dynamic:const MonacoEditor = dynamic(() => import('@monaco-editor/react'), { ssr: false })next buildand compare bundle analysis before and after usingANALYZE=trueImpacted Files:
@monaco-editor/react,video.js, orethersdirectlynext.config.tsAcceptance Criteria