Reputation: 46
I have just tried using ReactJS recently, and I came across and played with this project which import JS modules via syntax like this:
import Particle from './Particle'
I wished to port the project to use gl-matrix
as a practice to get familiar myself with this framework, but now I'm unsure how I should proceed. Should I be able to require
as suggested on this page, or there is some way to import
gl-matrix
?
Upvotes: 0
Views: 1971
Reputation: 3864
I believe you can just require
it like usual:
var glm = require('gl-matrix');
Of course, make sure you've run
npm install --save gl-matrix
or have gl-matrix
as a dependency in your package.json
. If that doesn't work, try just importing the script directly in your index.html
:
<script src="gl-matrix-min.js"></script>
Then you should be good.
Upvotes: 2