Closed nlopin closed 5 years ago
Hi @nlopin,
That's weird, it should work. However, I would not recommend to require /data
.
Since v2.0.0 data is a much simpler object (to make it 72% lighter), therefore some duplicated data was removed and object keys are not descriptive. However you can get a similar object by doing:
const ct = require('countries-and-timezones');
const data = {
countries: ct.getAllCountries(),
timezones: ct.getAllTimezones()
};
I do not require /data
it is required internally in the library. I'll investigate more
I see. Apparently is not a good practice to load json files with require
.
Could you try changing the file projectname/node_modules/countries-and-timezones/src/index.js
From:
const data = require('./data');
To
const data = require('./data.json');
If that works, could you tell me you node version and operative system?
Meanwhile I'll check the best practices to require json files.
According to documentation, require
is designed to support JSON files as long as .json
extension is used.
v2.0.3 should fix the issue.
Thank you, 2.0.3 fixes the issue
Hi!
After update to version 2, my app started to fail with the error: