I'm using binpacking in a create-react-app application with node 10 and getting the following error:
Uncaught TypeError: Packer is not a constructor
import binpack from 'binpacking'
const Packer = binpack.Packer
console.log(binpack)
const packer = new Packer(30,20)
The offending line is const Packer = binpack.Packer
The main file for the NPM package is (in its entirety)
exports.GrowingPacker = require('./packer.growing.js').GrowingPacker;
exports.Packer = require('./packer.js').Packer;
When I console log binpack I see that both GrowingPacker and Packer are undefined.
I'm at a loss here -- I'm sure it's something to do with requires or imports, but I'm lost. I tried using 'require' in my file in place of 'import', but it changed nothing.
I'm using binpacking in a create-react-app application with node 10 and getting the following error:
The offending line is
const Packer = binpack.PackerThe main file for the NPM package is (in its entirety)
When I console log
binpackI see that both GrowingPacker and Packer are undefined.I'm at a loss here -- I'm sure it's something to do with requires or imports, but I'm lost. I tried using 'require' in my file in place of 'import', but it changed nothing.