Saturday, 22 April 2017

javascript `require` instead of html `script` at three.js file in node.js

I use javascript require instead of html script at three.js file in node.js. a section of html file:

        <script src="../build/three.js"></script>

        <script src="js/controls/DragControls.js"></script>
        <script src="js/controls/OrbitControls.js"></script>
        <script src="js/controls/TransformControls.js"></script>

        <script src="js/libs/stats.min.js"></script>
        <script src="js/libs/dat.gui.min.js"></script>

an equivalent section of javascript file:

    var THREE=require('../build/three.js')

    //module.exports = THREE

    THREE.DragControls = require('./js/controls/DragControls.js')
    THREE.OrbitControls = require('./js/controls/OrbitControls.js')
    THREE.TransformControls = require('./js/controls/TransformControls.js')

    var Stats=require('./js/libs/stats.min.js')
    var dat=require('./js/libs/dat.gui.min.js')

so the browserify command show blank page in the browser.I think maybe the codes in javascript js file are not correct.so what should I do?



via hasanbaghal

No comments:

Post a Comment