Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Create paths that work cross-platform #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fwextensions
Copy link
Member

  • Use proper file URLs when dynamically importing JS files, instead of relying on absolute macOS file paths looking like parts of URLs.
  • Generate paths only in config.js.

Copy link
Member

@zoobot zoobot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on osx :)
@jazhen Does it work on your windows setup?
no rush, I am not uploading another vector tiles set to mapbox until the 30th.

Use proper file URLs when dynamically importing JS files, instead of relying on absolute macOS file paths looking like parts of URLs.
Generate paths only in config.js.
@fwextensions fwextensions force-pushed the jdunning/fix/2022/make-cross-platform-paths branch from 6ed4cc3 to b112674 Compare April 28, 2022 01:19
@jazhen
Copy link
Contributor

jazhen commented Apr 29, 2022

I'm on mac and this isn't working for me. I don't think the paths to the source files are being created correctly. For example, before the import location was /Users/jzhen/Dev/waterthetrees/wtt_area/sources/argentina.js and now is /sources/argentina.js.

Here's a screenshot of what I see on this branch.
after

And here's what it looks like for me on the main branch.
before

const country = (await import(path.join(__root, `/sources/${sourceName}`)))
.default;
const importURL = new URL(`/sources/${sourceName}`, ROOT_URL);
const country = (await import(importURL)).default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting a error on this line because importURL is not a file that can't be found.

2022-04-28 22:03:34 error: CATCH Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/sources/argentina.js' imported from /Users/jzhen/Dev/waterthetrees/wtt_area/bin/write-sources.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants