Import non module LineMaterial.js

es6
modules

#1

Hi, I’m using a bundler to build three.js and would like to add the LineMaterial.js.
Unfortunately this isn’t an official module and I have no idea how to import it correctly (this is the first time i’m using a bundler) For now it gives me a THREE not found.

I tried to do something like that
import * as THREE from 'three'
import lineMaterial from './LineMaterial'

How would you do that correctly?

Thanks!


#2

What bundler are you using? Normally, you’d run npm install three --save on your command line, and that makes the 'three' module available for import throughout your project. Then you could copy-paste the linematerial.js file into your project, but you have to make sure that you also do import * as THREE from 'three' at the beginning of that file, so it has access to all classes within the THREE namespace.