Closed Fitzpasd closed 4 years ago
Hi, I went through something similar, using react native too.
Probably it's caused by the way of the module is exported.
I've solved changing the source code. Take a look:
...
/**
* @public
* @type {Object|null}
*/
// just comment this line, it'll fix the NodeJS package
// but will crash the use in the browser :\
// var module;
/**
* API entry
* @public
* @param {function(Object)|Date|number} start the starting date
* @param {function(Object)|Date|number} end the ending date
* @param {number} units the units to populate
* @return {Object|number}
*/
var countdown = (
...
)(module);
I'll submit a PR suggesting this.
The problem is the way of the module is exported.
You guys can change it to be compatible with the browser and as a Node JS module?
I can submit the new code in few weeks, if you do not have time for this.
Any update?
FYI https://github.com/mckamey/countdownjs/pull/31 fixes it. I badly need it so I've created a patch locally until it gets merged
I believe this should now be resolved with the PR?
@mckamey Can you release the fixed version.
I'm sure this is something I'm doing wrong, but I can't figure it out and I'm hoping someone here might have some experience with this.
For some reason, when I require this library and bundle my source code with the react native packager, the source of this library doesn't get bundled and therefore I get exceptions when calling the functions. I'm using typescript and have tried all the known ways of importing, and also have tried changing the .js source that is compiled.
What I have:
Here's the compiled js code which is having issues:
I have this library setup and imported the exact same way as others (e.g. lodash, reactxp), and this is the only one that doesn't get bundled.
I'm running the packager the standard way, and have tried clearing
node_modules
and all the caches.Here's an SO question I also opened to try get some help:
I have even tried adding a
require
call to my rootindex.js
, which also doesn't work