Skip to content

Fix for undefined coreutils#44

Open
akre54 wants to merge 1 commit intoplacemark:mainfrom
akre54:fix-undefined-coreutils
Open

Fix for undefined coreutils#44
akre54 wants to merge 1 commit intoplacemark:mainfrom
akre54:fix-undefined-coreutils

Conversation

@akre54
Copy link
Copy Markdown

@akre54 akre54 commented Jan 7, 2026

I was getting a few issues with osmtogeojson on plugin load.

The issue was that osmtogeojson version 3.0.0-beta.5 bundles a version of lodash that requires window.__core-js_shared__, which cannot be set in Figma's restrictive sandbox environment (you can't define properties on window / root). I initially tried to change the banner in the build script but fundamentally I wasn't able to modify the environment.

I've downgraded the package to version 2.2.12, which is a stable release that doesn't have this dependency issue.

Changes made:

  • Updated package.json to use osmtogeojson version 2.2.12
  • Removed the polyfill banner from build.js since it's no longer needed
  • Reinstalled dependencies with the new version

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 7, 2026

⚠️ No Changeset found

Latest commit: f2ae95a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@akre54
Copy link
Copy Markdown
Author

akre54 commented Jan 7, 2026

osmtogeojson hasn't been updated in a few years. Worth forking maybe?

@tmcw
Copy link
Copy Markdown
Collaborator

tmcw commented Jan 7, 2026

Hey Adam!

Weird, I don't think that I've made any modifications that would case that problem - maybe the Figma sandbox changed?

A fork seems reasonable - I've tried to make an osmtogeojson successor of sorts in the past but burned out of it… just fixing a few tiny things on the other hand should be fine.

"rbush": "^3.0.1"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This project is using npm (there's a pnpm-lock)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Understood! Will revert

@akre54
Copy link
Copy Markdown
Author

akre54 commented Jan 7, 2026

Thanks Tom! Appreciate your work on this and hoping to get to use it.

Weird, I don't think that I've made any modifications that would case that problem - maybe the Figma sandbox changed?

Possibly! I can imagine they've locked down the sandbox a bunch. It's a bummer there are still a million hacky ways to load third-party js, so it might be that a fork is the best fix. Would you prefer to own in under your account, the placemark org, or under my account? I'm fine with anything (and to your point it might be easier to start with a small fork before going more holistic)

@akre54
Copy link
Copy Markdown
Author

akre54 commented Jan 7, 2026

Just to note, even after this fix I'm still seeing timeout issues except on really high zoom levels. When I did get it to load it was only able to add the attribution text element. And then I had to put this particular yak-shave aside to work on something else

I'm happy to make the changes but wanted to know if there's something I'm not seeing before investing too much time in this

@tmcw
Copy link
Copy Markdown
Collaborator

tmcw commented Jan 7, 2026

If you mean high as in low numbers, that's going to be mostly a core principle of the system: how this plugin works is that it requests raw data from OpenStreetMap and renders it from scratch. At zooms 0-6 for example, if you're requesting highway=trunk you're going to get a whole country worth of highways, at full resolution, and that's going to be a lot of data, take a while to parse, and eventually Figma's probably going to be a bit laggy because it's not really efficient enough for map data.

Basically the idea is partly that this approach gives proper geometries and data that you wouldn't get if you had a tiled or raster representation, but the flipside is that it does have that raw data. I think it'd make sense to selectively load roads at country-level zooms, or maybe a different dataset entirely. You can see this principle with OpenStreetMap's editors too - iD doesn't let you edit zoomed out to a country because it'd be a tremendous amount of data.

There are ways out, like loading only high-level highways and dropping other features at those zoom levels, or -- much higher time investment -- having a simplified dataset that this could load from.

@akre54
Copy link
Copy Markdown
Author

akre54 commented Jan 8, 2026

Yeah on high zoom levels (i.e. street level) I was able to get the request to complete but nothing rendered - and then I gave up.

On low zoom levels (city and below) it timed out. I'd love to take another crack at this, or try to wire it into Noodles.gl for export to Figma somehow.

What you say makes sense, and I wonder how difficult it would be to add some zoom-based filtering (or to use the mapbox style spec to determine which to render).

@tmcw
Copy link
Copy Markdown
Collaborator

tmcw commented Jan 11, 2026

Oddly I can't replicate the crash you're seeing, using the latest version of Figma and the latest version of the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants