node-harvest: TypeError: Harvest is not a constructor
Node version: 8.9.3 / 10.7.0 Harvest version: 2.0.3
const Harvest = require('harvest')
const harvest = new Harvest({/* ... */})
// TypeError: Harvest is not a constructor
What’s going on?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 23 (21 by maintainers)
Commits related to this issue
- feat(commonjs): Added support for commonjs The initial conversion of the module to typescript was bundling a module that supported the ES6 import, but not the commonjs require. Added an index.js to t... — committed to simplyspoke/node-harvest by simplyspoke 6 years ago
- fix(package.json): Included index.js for commonjs re #108 — committed to simplyspoke/node-harvest by simplyspoke 6 years ago
- Merge pull request #112 from Jameskmonger/master Fix #108: Export default class correctly — committed to simplyspoke/node-harvest by simplyspoke 6 years ago
I like having that bit of backwards compatibility. If it reduces the chance people with have any issues, seems like a win.
I agree @Jameskmonger…
This is a rather lightweight and simple module, so throwing a bundler in front of the packaging process doesn’t feel like it gets us much.
As for the imports, I tested both a ts file and js file just shifting the module loader and it looks like it should fix both needs well. Would like to get a better eye on it before pushing up the changes as I only had 15min to test my approach. Might be nice to pair with pulling out webpack.
I will investigate this shortly @simplyspoke