Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm running into the same issue as #159 due to using a build process which bundles all of my code and dependencies for AWS Lambda functions. That build process means that the JSON files within the
data
dir of this package are bundled automatically because they userequire
, but the.dat
files are not since they're loaded at runtime usingfs
.I can copy the
data
dir into my build folder usingcopy-webpack-plugin
(or similar for rollup/esbuild/vite processes) so it is available to the runtime, but after bundling, the location of thegeo-tz
JS would be in an unexpected place so the../data
location it's looking for is most likely going to be incorrect. In my case, this package ended up in the root folder of my Lambda bundle, so../data
was outside of the file system I had access to modify. For AWS Lambda specifically, we can also make use of layers to store static dependencies, but the path will again most likely not be available to the../data
path this package expects.To remedy this issue, this PR adds support for a
GEO_TZ_DATA_PATH
environment variable that allows thedata
directory to be moved or renamed as needed for each use case (his is effectively the same solution as #140, but updated to support the different data sets added in #162/#163).