Sunday, 16 April 2017

Node could not compile three.js-editor javascript that I created

Node could not compile three.js-editor javascript the source file is

https://github.com/mrdoob/three.js/blob/dev/editor/index.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>three.js / editor</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    </head>
    <body ontouchstart="">
        <link href="css/main.css" rel="stylesheet" />
        <link id="theme" href="css/light.css" rel="stylesheet" />



        <script src="js/libs/three.min.js"></script>
        <script src="js/libs/system.min.js"></script>

        <script>
            // fix for ui-builder
            window.module = {};
        </script>

        <script src="js/libs/react-lite.min.js"></script>
        <script src="ui-builder/react/core.js"></script>

        <script>
            // ui-builder
            window.R = window.module.exports(React, false).R;
            delete window.module;
        </script>

        <script src="js/controls/EditorControls.js"></script>
        <script src="js/controls/TransformControls.js"></script>

        <script src="js/libs/jszip.min.js"></script>
        <script src="js/loaders/AMFLoader.js"></script>
        <script src="js/loaders/AWDLoader.js"></script>
        <script src="js/loaders/BabylonLoader.js"></script>
        <script src="js/loaders/ColladaLoader2.js"></script>
        <script src="js/loaders/FBXLoader.js"></script>
        <script src="js/loaders/GLTFLoader.js"></script>
        <script src="js/loaders/KMZLoader.js"></script>
        <script src="js/loaders/MD2Loader.js"></script>
        <script src="js/loaders/OBJLoader.js"></script>
        <script src="js/loaders/PlayCanvasLoader.js"></script>
        <script src="js/loaders/PLYLoader.js"></script>
        <script src="js/loaders/STLLoader.js"></script>
        <script src="js/loaders/TGALoader.js"></script>
        <script src="js/loaders/UTF8Loader.js"></script>
        <script src="js/loaders/VRMLLoader.js"></script>
        <script src="js/loaders/VTKLoader.js"></script>
        <script src="js/loaders/ctm/lzma.js"></script>
        <script src="js/loaders/ctm/ctm.js"></script>
        <script src="js/loaders/ctm/CTMLoader.js"></script>

        <script src="js/loaders/deprecated/SceneLoader.js"></script>

        <script src="js/renderers/Projector.js"></script>
        <script src="js/renderers/CanvasRenderer.js"></script>
        <script src="js/renderers/RaytracingRenderer.js"></script>
        <script src="js/renderers/SoftwareRenderer.js"></script>
        <script src="js/renderers/SVGRenderer.js"></script>

        <link rel="stylesheet" href="js/libs/codemirror/codemirror.css">
        <link rel="stylesheet" href="js/libs/codemirror/theme/monokai.css">
        <script src="js/libs/codemirror/codemirror.js"></script>
        <script src="js/libs/codemirror/mode/javascript.js"></script>
        <script src="js/libs/codemirror/mode/glsl.js"></script>

        <script src="js/libs/esprima.js"></script>
        <script src="js/libs/jsonlint.js"></script>
        <script src="js/libs/glslprep.min.js"></script>

        <link rel="stylesheet" href="js/libs/codemirror/addon/dialog.css">
        <link rel="stylesheet" href="js/libs/codemirror/addon/show-hint.css">
        <link rel="stylesheet" href="js/libs/codemirror/addon/tern.css">
        <script src="js/libs/codemirror/addon/dialog.js"></script>
        <script src="js/libs/codemirror/addon/show-hint.js"></script>
        <script src="js/libs/codemirror/addon/tern.js"></script>
        <script src="js/libs/acorn/acorn.js"></script>
        <script src="js/libs/acorn/acorn_loose.js"></script>
        <script src="js/libs/acorn/walk.js"></script>
        <script src="js/libs/ternjs/polyfill.js"></script>
        <script src="js/libs/ternjs/signal.js"></script>
        <script src="js/libs/ternjs/tern.js"></script>
        <script src="js/libs/ternjs/def.js"></script>
        <script src="js/libs/ternjs/comment.js"></script>
        <script src="js/libs/ternjs/infer.js"></script>
        <script src="js/libs/ternjs/doc_comment.js"></script>
        <script src="js/libs/tern-threejs/threejs.js"></script>

        <script src="js/libs/signals.min.js"></script>
        <script src="js/libs/ui.js"></script>
        <script src="js/libs/ui.three.js"></script>

        <script src="dgframe/index.js"></script>
        <script src="js/libs/app.js"></script>
        <script src="js/Player.js"></script>
        <script src="js/Script.js"></script>

        <script src="js/effects/VREffect.js"></script>
        <script src="js/controls/VRControls.js"></script>
        <script src="js/controls/OrbitControls.js"></script>
        <script src="js/vr/WebVR.js"></script>

        <script src="js/Storage.js"></script>

        <script src="js/Editor.js"></script>
        <script src="js/Config.js"></script>
        <script src="js/History.js"></script>
        <script src="js/Loader.js"></script>
        <script src="js/Menubar.js"></script>
        <script src="js/Menubar.File.js"></script>
        <script src="js/Menubar.Edit.js"></script>
        <script src="js/Menubar.Add.js"></script>
        <script src="js/Menubar.Play.js"></script>
        <script src="js/Menubar.View.js"></script>
        <!-- <script src="js/Menubar.Examples.js"></script> -->
        <script src="js/Menubar.Help.js"></script>
        <script src="js/Menubar.Status.js"></script>
        <script src="js/Sidebar.js"></script>
        <script src="js/Sidebar.Scene.js"></script>
        <script src="js/Sidebar.Project.js"></script>
        <script src="js/Sidebar.Data.js"></script>
        <script src="js/Sidebar.Settings.js"></script>
        <script src="js/Sidebar.Properties.js"></script>
        <script src="js/Sidebar.Object.js"></script>
        <script src="js/Sidebar.Geometry.js"></script>
        <script src="js/Sidebar.Geometry.Geometry.js"></script>
        <script src="js/Sidebar.Geometry.BufferGeometry.js"></script>
        <script src="js/Sidebar.Geometry.Modifiers.js"></script>
        <script src="js/Sidebar.Geometry.BoxGeometry.js"></script>
        <script src="js/Sidebar.Geometry.CircleGeometry.js"></script>
        <script src="js/Sidebar.Geometry.CylinderGeometry.js"></script>
        <script src="js/Sidebar.Geometry.IcosahedronGeometry.js"></script>
        <script src="js/Sidebar.Geometry.PlaneGeometry.js"></script>
        <script src="js/Sidebar.Geometry.SphereGeometry.js"></script>
        <script src="js/Sidebar.Geometry.TorusGeometry.js"></script>
        <script src="js/Sidebar.Geometry.TorusKnotGeometry.js"></script>
        <script src="js/geometries/TeapotBufferGeometry.js"></script>
        <script src="js/Sidebar.Geometry.TeapotBufferGeometry.js"></script>
        <script src="js/Sidebar.Geometry.LatheGeometry.js"></script>
        <script src="js/Sidebar.Material.js"></script>
        <script src="js/Sidebar.Animation.js"></script>
        <script src="js/Sidebar.Script.js"></script>
        <script src="js/Sidebar.GlobalScripts.js"></script>
        <script src="js/Sidebar.History.js"></script>
        <script src="js/Toolbar.js"></script>
        <script src="js/Viewport.js"></script>
        <script src="js/Viewport.Info.js"></script>

        <script src="js/Command.js"></script>
        <script src="js/commands/AddObjectCommand.js"></script>
        <script src="js/commands/RemoveObjectCommand.js"></script>
        <script src="js/commands/MoveObjectCommand.js"></script>
        <script src="js/commands/SetPositionCommand.js"></script>
        <script src="js/commands/SetRotationCommand.js"></script>
        <script src="js/commands/SetScaleCommand.js"></script>
        <script src="js/commands/SetValueCommand.js"></script>
        <script src="js/commands/SetUuidCommand.js"></script>
        <script src="js/commands/SetColorCommand.js"></script>
        <script src="js/commands/SetGeometryCommand.js"></script>
        <script src="js/commands/SetGeometryValueCommand.js"></script>
        <script src="js/commands/MultiCmdsCommand.js"></script>
        <script src="js/commands/AddScriptCommand.js"></script>
        <script src="js/commands/RemoveScriptCommand.js"></script>
        <script src="js/commands/SetScriptValueCommand.js"></script>
        <script src="js/commands/SetMaterialCommand.js"></script>
        <script src="js/commands/SetMaterialValueCommand.js"></script>
        <script src="js/commands/SetMaterialColorCommand.js"></script>
        <script src="js/commands/SetMaterialMapCommand.js"></script>
        <script src="js/commands/SetSceneCommand.js"></script>

        <!-- <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="qyqgfqd9j8z890t"></script> -->

        <script src="js/libs/html2canvas.js"></script>
        <script src="js/libs/three.html.js"></script>

        <script>


            window.URL = window.URL || window.webkitURL;
            window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;

            window.isThreeEditor = true;

            Number.prototype.format = function (){
                return this.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
            };

            //

            var editor = new Editor();

            var viewport = new Viewport( editor );
            document.body.appendChild( viewport.dom );

            var script = new Script( editor );
            document.body.appendChild( script.dom );

            var player = new Player( editor );
            document.body.appendChild( player.dom );

            var toolbar = new Toolbar( editor );
            document.body.appendChild( toolbar.dom );

            var menubar = new Menubar( editor );
            document.body.appendChild( menubar.dom );

            var sidebar = new Sidebar( editor );
            document.body.appendChild( sidebar.dom );

            var modal = new UI.Modal();
            document.body.appendChild( modal.dom );

            //


            editor.setTheme( editor.config.getKey( 'theme' ) );

            editor.storage.init( function () {

                editor.storage.get( function ( state ) {

                    if ( isLoadingFromHash ) return;

                    if ( state !== undefined ) {

                        editor.fromJSON( state );

                    }

                    var selected = editor.config.getKey( 'selected' );

                    if ( selected !== undefined ) {

                        editor.selectByUuid( selected );

                    }

                } );

                //

                var timeout;

                function saveState( scene ) {

                    if ( editor.config.getKey( 'autosave' ) === false ) {

                        return;

                    }

                    clearTimeout( timeout );

                    timeout = setTimeout( function () {

                        editor.signals.savingStarted.dispatch();

                        timeout = setTimeout( function () {

                            editor.storage.set( editor.toJSON() );

                            editor.signals.savingFinished.dispatch();

                        }, 100 );

                    }, 1000 );

                };

                var signals = editor.signals;

                signals.geometryChanged.add( saveState );
                signals.objectAdded.add( saveState );
                signals.objectChanged.add( saveState );
                signals.objectRemoved.add( saveState );
                signals.materialChanged.add( saveState );
                signals.sceneBackgroundChanged.add( saveState );
                signals.sceneFogChanged.add( saveState );
                signals.sceneGraphChanged.add( saveState );
                signals.scriptChanged.add( saveState );
                signals.historyChanged.add( saveState );

                signals.showModal.add( function ( content ) {

                    modal.show( content );

                } );

            } );

            //

            document.addEventListener( 'dragover', function ( event ) {

                event.preventDefault();
                event.dataTransfer.dropEffect = 'copy';

            }, false );

            document.addEventListener( 'drop', function ( event ) {

                event.preventDefault();

                if ( event.dataTransfer.files.length > 0 ) {

                    editor.loader.loadFile( event.dataTransfer.files[ 0 ] );

                }

            }, false );

            document.addEventListener( 'keydown', function ( event ) {

                switch ( event.keyCode ) {

                    case 8: // backspace

                        event.preventDefault(); // prevent browser back

                    case 46: // delete

                        var object = editor.selected;

                        if ( confirm( 'Delete ' + object.name + '?' ) === false ) return;

                        var parent = object.parent;
                        if ( parent !== null ) editor.execute( new RemoveObjectCommand( object ) );

                        break;

                    case 90: // Register Ctrl-Z for Undo, Ctrl-Shift-Z for Redo

                        if ( event.ctrlKey && event.shiftKey ) {

                            editor.redo();

                        } else if ( event.ctrlKey ) {

                            editor.undo();

                        }

                        break;

                    case 87: // Register W for translation transform mode

                        editor.signals.transformModeChanged.dispatch( 'translate' );

                        break;

                    case 69: // Register E for rotation transform mode

                        editor.signals.transformModeChanged.dispatch( 'rotate' );

                        break;

                    case 82: // Register R for scaling transform mode

                        editor.signals.transformModeChanged.dispatch( 'scale' );

                        break;

                }

            }, false );

            function onWindowResize( event ) {

                editor.signals.windowResize.dispatch();

            }

            window.addEventListener( 'resize', onWindowResize, false );

            onWindowResize();

            //

            var isLoadingFromHash = false;
            var hash = window.location.hash;

            if ( hash.substr( 1, 5 ) === 'file=' ) {

                var file = hash.substr( 6 );

                if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {

                    var loader = new THREE.XHRLoader();
                    loader.crossOrigin = '';
                    loader.load( file, function ( text ) {

                        editor.clear();
                        editor.fromJSON( JSON.parse( text ) );

                    } );

                    isLoadingFromHash = true;

                }

            }

            /*
            window.addEventListener( 'message', function ( event ) {

                editor.clear();
                editor.fromJSON( event.data );

            }, false );
            */

            dgframe.foreign.init();

            // VR

            var groupVR;

            // TODO: Use editor.signals.enteredVR (WebVR 1.0)

            editor.signals.enterVR.add( function () {

                if ( groupVR === undefined ) {

                    groupVR = new THREE.HTMLGroup( viewport.dom );
                    editor.sceneHelpers.add( groupVR );

                    var mesh = new THREE.HTMLMesh( sidebar.dom );
                    mesh.position.set( 15, 0, 15 );
                    mesh.rotation.y = - 0.5;
                    groupVR.add( mesh );

                    var signals = editor.signals;

                    function updateTexture() {

                        mesh.material.map.update();

                    }

                    signals.objectSelected.add( updateTexture );
                    signals.objectAdded.add( updateTexture );
                    signals.objectChanged.add( updateTexture );
                    signals.objectRemoved.add( updateTexture );
                    signals.sceneGraphChanged.add( updateTexture );
                    signals.historyChanged.add( updateTexture );

                }

                groupVR.visible = true;

            } );

            editor.signals.exitedVR.add( function () {

                if ( groupVR !== undefined ) groupVR.visible = false;

            } );


        </script>
    </body>
</html>

so I use require to include libraries into an javascript file

this is my javascript file

index_editor_java_01.js

    require('./js/libs/three.min.js')
    require('./js/libs/system.min.js')



    require('./js/libs/react-lite.min.js')
    require('./ui-builder/react/core.js')


    require('./js/controls/EditorControls.js')
    require('./js/controls/TransformControls.js')

    require('./js/libs/jszip.min.js')
    require('./js/loaders/AMFLoader.js')
    require('./js/loaders/AWDLoader.js')
    require('./js/loaders/BabylonLoader.js')
    require('./js/loaders/ColladaLoader2.js')
    require('./js/loaders/FBXLoader.js')
    require('./js/loaders/GLTFLoader.js')
    require('./js/loaders/KMZLoader.js')
    require('./js/loaders/MD2Loader.js')
    require('./js/loaders/OBJLoader.js')
    require('./js/loaders/PlayCanvasLoader.js')
    require('./js/loaders/PLYLoader.js')
    require('./js/loaders/STLLoader.js')
    require('./js/loaders/TGALoader.js')
    require('./js/loaders/UTF8Loader.js')
    require('./js/loaders/VRMLLoader.js')
    require('./js/loaders/VTKLoader.js')
    require('./js/loaders/ctm/lzma.js')
    require('./js/loaders/ctm/ctm.js')
    require('./js/loaders/ctm/CTMLoader.js')

    require('./js/loaders/deprecated/SceneLoader.js')

    require('./js/renderers/Projector.js')
    require('./js/renderers/CanvasRenderer.js')
    require('./js/renderers/RaytracingRenderer.js')
    require('./js/renderers/SoftwareRenderer.js')
    require('./js/renderers/SVGRenderer.js')


    require('./js/libs/codemirror/codemirror.js')
    require('./js/libs/codemirror/mode/javascript.js')
    require('./js/libs/codemirror/mode/glsl.js')

    require('./js/libs/esprima.js')
    require('./js/libs/jsonlint.js')
    require('./js/libs/glslprep.min.js')

    require('./js/libs/codemirror/addon/dialog.js')
    require('./js/libs/codemirror/addon/show-hint.js')
    require('./js/libs/codemirror/addon/tern.js')
    require('./js/libs/acorn/acorn.js')
    require('./js/libs/acorn/acorn_loose.js')
    require('./js/libs/acorn/walk.js')
    require('./js/libs/ternjs/polyfill.js')
    require('./js/libs/ternjs/signal.js')
    require('./js/libs/ternjs/tern.js')
    require('./js/libs/ternjs/def.js')
    require('./js/libs/ternjs/comment.js')
    require('./js/libs/ternjs/infer.js')
    require('./js/libs/ternjs/doc_comment.js')
    require('./js/libs/tern-threejs/threejs.js')

    require('./js/libs/signals.min.js')
    require('./js/libs/ui.js')
    require('./js/libs/ui.three.js')

    require('./dgframe/index.js')
    require('./js/libs/app.js')
    require('./js/Player.js')
    require('./js/Script.js')

    require('./js/effects/VREffect.js')
    require('./js/controls/VRControls.js')
    require('./js/controls/OrbitControls.js')
    require('./js/vr/WebVR.js')

    require('./js/Storage.js')

    require('./js/Editor.js')
    require('./js/Config.js')
    require('./js/History.js')
    require('./js/Loader.js')
    require('./js/Menubar.js')
    require('./js/Menubar.File.js')
    require('./js/Menubar.Edit.js')
    require('./js/Menubar.Add.js')
    require('./js/Menubar.Play.js')
    require('./js/Menubar.View.js')

    require('./js/Menubar.Help.js')
    require('./js/Menubar.Status.js')
    require('./js/Sidebar.js')
    require('./js/Sidebar.Scene.js')
    require('./js/Sidebar.Project.js')
    require('./js/Sidebar.Data.js')
    require('./js/Sidebar.Settings.js')
    require('./js/Sidebar.Properties.js')
    require('./js/Sidebar.Object.js')
    require('./js/Sidebar.Geometry.js')
    require('./js/Sidebar.Geometry.Geometry.js')
    require('./js/Sidebar.Geometry.BufferGeometry.js')
    require('./js/Sidebar.Geometry.Modifiers.js')
    require('./js/Sidebar.Geometry.BoxGeometry.js')
    require('./js/Sidebar.Geometry.CircleGeometry.js')
    require('./js/Sidebar.Geometry.CylinderGeometry.js')
    require('./js/Sidebar.Geometry.IcosahedronGeometry.js')
    require('./js/Sidebar.Geometry.PlaneGeometry.js')
    require('./js/Sidebar.Geometry.SphereGeometry.js')
    require('./js/Sidebar.Geometry.TorusGeometry.js')
    require('./js/Sidebar.Geometry.TorusKnotGeometry.js')
    require('./js/geometries/TeapotBufferGeometry.js')
    require('./js/Sidebar.Geometry.TeapotBufferGeometry.js')
    require('./js/Sidebar.Geometry.LatheGeometry.js')
    require('./js/Sidebar.Material.js')
    require('./js/Sidebar.Animation.js')
    require('./js/Sidebar.Script.js')
    require('./js/Sidebar.GlobalScripts.js')
    require('./js/Sidebar.History.js')
    require('./js/Toolbar.js')
    require('./js/Viewport.js')
    require('./js/Viewport.Info.js')

    require('./js/Command.js')
    require('./js/commands/AddObjectCommand.js')
    require('./js/commands/RemoveObjectCommand.js')
    require('./js/commands/MoveObjectCommand.js')
    require('./js/commands/SetPositionCommand.js')
    require('./js/commands/SetRotationCommand.js')
    require('./js/commands/SetScaleCommand.js')
    require('./js/commands/SetValueCommand.js')
    require('./js/commands/SetUuidCommand.js')
    require('./js/commands/SetColorCommand.js')
    require('./js/commands/SetGeometryCommand.js')
    require('./js/commands/SetGeometryValueCommand.js')
    require('./js/commands/MultiCmdsCommand.js')
    require('./js/commands/AddScriptCommand.js')
    require('./js/commands/RemoveScriptCommand.js')
    require('./js/commands/SetScriptValueCommand.js')
    require('./js/commands/SetMaterialCommand.js')
    require('./js/commands/SetMaterialValueCommand.js')
    require('./js/commands/SetMaterialColorCommand.js')
    require('./js/commands/SetMaterialMapCommand.js')
    require('./js/commands/SetSceneCommand.js')



    require('./js/libs/html2canvas.js')
    require('./js/libs/three.html.js')



        window.URL = window.URL || window.webkitURL;
        window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;

        window.isThreeEditor = true;

        Number.prototype.format = function (){
            return this.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
        };

        //

        var editor = new Editor();

        var viewport = new Viewport( editor );
        document.body.appendChild( viewport.dom );

        var script = new Script( editor );
        document.body.appendChild( script.dom );

        var player = new Player( editor );
        document.body.appendChild( player.dom );

        var toolbar = new Toolbar( editor );
        document.body.appendChild( toolbar.dom );

        var menubar = new Menubar( editor );
        document.body.appendChild( menubar.dom );

        var sidebar = new Sidebar( editor );
        document.body.appendChild( sidebar.dom );

        var modal = new UI.Modal();
        document.body.appendChild( modal.dom );

        //

        editor.setTheme( editor.config.getKey( 'theme' ) );

        editor.storage.init( function () {

            editor.storage.get( function ( state ) {

                if ( isLoadingFromHash ) return;

                if ( state !== undefined ) {

                    editor.fromJSON( state );

                }

                var selected = editor.config.getKey( 'selected' );

                if ( selected !== undefined ) {

                    editor.selectByUuid( selected );

                }

            } );

            //

            var timeout;

            function saveState( scene ) {

                if ( editor.config.getKey( 'autosave' ) === false ) {

                    return;

                }

                clearTimeout( timeout );

                timeout = setTimeout( function () {

                    editor.signals.savingStarted.dispatch();

                    timeout = setTimeout( function () {

                        editor.storage.set( editor.toJSON() );

                        editor.signals.savingFinished.dispatch();

                    }, 100 );

                }, 1000 );

            };

            var signals = editor.signals;

            signals.geometryChanged.add( saveState );
            signals.objectAdded.add( saveState );
            signals.objectChanged.add( saveState );
            signals.objectRemoved.add( saveState );
            signals.materialChanged.add( saveState );
            signals.sceneBackgroundChanged.add( saveState );
            signals.sceneFogChanged.add( saveState );
            signals.sceneGraphChanged.add( saveState );
            signals.scriptChanged.add( saveState );
            signals.historyChanged.add( saveState );

            signals.showModal.add( function ( content ) {

                modal.show( content );

            } );

        } );

        //

        document.addEventListener( 'dragover', function ( event ) {

            event.preventDefault();
            event.dataTransfer.dropEffect = 'copy';

        }, false );

        document.addEventListener( 'drop', function ( event ) {

            event.preventDefault();

            if ( event.dataTransfer.files.length > 0 ) {

                editor.loader.loadFile( event.dataTransfer.files[ 0 ] );

            }

        }, false );

        document.addEventListener( 'keydown', function ( event ) {

            switch ( event.keyCode ) {

                case 8: // backspace

                    event.preventDefault(); // prevent browser back

                case 46: // delete

                    var object = editor.selected;

                    if ( confirm( 'Delete ' + object.name + '?' ) === false ) return;

                    var parent = object.parent;
                    if ( parent !== null ) editor.execute( new RemoveObjectCommand( object ) );

                    break;

                case 90: // Register Ctrl-Z for Undo, Ctrl-Shift-Z for Redo

                    if ( event.ctrlKey && event.shiftKey ) {

                        editor.redo();

                    } else if ( event.ctrlKey ) {

                        editor.undo();

                    }

                    break;

                case 87: // Register W for translation transform mode

                    editor.signals.transformModeChanged.dispatch( 'translate' );

                    break;

                case 69: // Register E for rotation transform mode

                    editor.signals.transformModeChanged.dispatch( 'rotate' );

                    break;

                case 82: // Register R for scaling transform mode

                    editor.signals.transformModeChanged.dispatch( 'scale' );

                    break;

            }

        }, false );

        function onWindowResize( event ) {

            editor.signals.windowResize.dispatch();

        }

        window.addEventListener( 'resize', onWindowResize, false );

        onWindowResize();

        //

        var isLoadingFromHash = false;
        var hash = window.location.hash;

        if ( hash.substr( 1, 5 ) === 'file=' ) {

            var file = hash.substr( 6 );

            if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {

                var loader = new THREE.XHRLoader();
                loader.crossOrigin = '';
                loader.load( file, function ( text ) {

                    editor.clear();
                    editor.fromJSON( JSON.parse( text ) );

                } );

                isLoadingFromHash = true;

            }

        }

        /*
        window.addEventListener( 'message', function ( event ) {

            editor.clear();
            editor.fromJSON( event.data );

        }, false );
        */

        dgframe.foreign.init();

        // VR

        var groupVR;

        // TODO: Use editor.signals.enteredVR (WebVR 1.0)

        editor.signals.enterVR.add( function () {

            if ( groupVR === undefined ) {

                groupVR = new THREE.HTMLGroup( viewport.dom );
                editor.sceneHelpers.add( groupVR );

                var mesh = new THREE.HTMLMesh( sidebar.dom );
                mesh.position.set( 15, 0, 15 );
                mesh.rotation.y = - 0.5;
                groupVR.add( mesh );

                var signals = editor.signals;

                function updateTexture() {

                    mesh.material.map.update();

                }

                signals.objectSelected.add( updateTexture );
                signals.objectAdded.add( updateTexture );
                signals.objectChanged.add( updateTexture );
                signals.objectRemoved.add( updateTexture );
                signals.sceneGraphChanged.add( updateTexture );
                signals.historyChanged.add( updateTexture );

            }

            groupVR.visible = true;

        } );

        editor.signals.exitedVR.add( function () {

                if ( groupVR !== undefined ) groupVR.visible = false;

            } );

and my command at node is

browserify index_editor_java_01.js| indexhtmlify > index_editor_java_01.html

many errors will be,for example one of them is :

Error: Cannot find module '../lib/infer' from 'C:\github01\editorfemgl01\js\libs\ternjs'
at C:\Users\admin\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:55:21
at load (C:\Users\admin\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (C:\Users\admin\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at C:\Users\admin\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:114:15)

so what's the solution? Regards



via hasanbaghal

No comments:

Post a Comment