Skip to content

"TypeError: Packer is not a constructor" ? #4

Description

@robert-barcelona

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions