How does js load on demand?

threejs needs to call too many js when building a scene, how to load it on demand?

tried requirejs, but didn"t feel quite in demand.

for example, to build a material, you need to import about 10 + js, but this material is not used initially (such as switching the display requirements of the material)
how to load the 10 + js? when it can be used.

Mar.30,2021

Native js can be loaded on demand by dynamically creating script tags.

if you are using react , you can use react-loadable this library to implement

.

requirejs seajs


require(['jquery'], function ($) {
    $(function () {
        //knockoutjs
        $("-sharptest").click(
            function () {
                require(['knockout'], function (ko) {
                    alert(ko.version);
                });
            }
        );
    });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea0b62-1afb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea0b62-1afb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?