简体   繁体   中英

NextJS : Script load base on unique id but want to load only one time and can use it in the whole page

The Screen Shot

It is related to the video players. I use TencentPlayer Lite to my use in my project.

So I customize that player by making it a component so I can add it to another component.

The TencentPlayer Lite needs to run the import script or use ES Module but I don't how to use it so I decided to use the Script in Nextjs to import it.

The Script is already optimized so it will not load again on the same page with the same src , it will load when the script scr change.

Tencent Player Lite Document

As of Next.js, this kind of problem occurs in development mode because of hot-module-replacement. But in production, it will only load once; therefore, don't worry about it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM