Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Compile for WASM #473

Open
srmncnk opened this issue Jul 2, 2024 · 2 comments
Open

[FEATURE] Compile for WASM #473

srmncnk opened this issue Jul 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@srmncnk
Copy link

srmncnk commented Jul 2, 2024

Feature Description

I want to build maplibre for web but using the wasm switch.

Describe alternatives you've considered

Mapbox has a few implementation out there but none are as good as this repository.

Additional context

Migration guide:
https://dart.dev/interop/js-interop
https://dart.dev/interop/js-interop/package-web

Errors while building for wasm:

^
../maplibre_gl_web/lib/src/interop/style/style_image_interop.dart:4:1: Error: JS interop library 'package:js/js.dart' can't be imported when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'package:js/js.dart';
^
../maplibre_gl_web/lib/src/interop/style/style_interop.dart:4:1: Error: JS interop library 'package:js/js.dart' can't be imported when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'package:js/js.dart';
^
../maplibre_gl_web/lib/src/interop/ui/map_interop.dart:5:1: Error: JS interop library 'package:js/js.dart' can't be imported when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'package:js/js.dart';
...
@srmncnk srmncnk added the enhancement New feature or request label Jul 2, 2024
@josxha
Copy link
Collaborator

josxha commented Jul 2, 2024

Thanks for the feature request @srmncnk. I allowed myself to shorten the error log a bit.

The current web implementation was written when js/dart interop was still in the early days. Adding support for wasm will be a bigger migration, maybe even rewrite of the maplibre_gl_web package. However, the package has currently no funding and therefore relies on pull requests by contributors. The voluntary work by the maintainers focusses at the moment on code reviews and keeping the package up-to-date. I'd be happy to review any contribution to the package via a pull request.
If you (or any other person interested in this feature) can't contribute yourself, you can offer a bounty to interest some other user to implement your feature request. If you are interested, just let me know here or on Slack. 👍

@srmncnk
Copy link
Author

srmncnk commented Jul 2, 2024

@josxha Thanks for the quick response. 👍 I'm aware of the scope, I took a whack at an old mapbox web implementation, but it's no longer maintained and Mapbox themselves don't bother with web in their new package either. So all those are plus points for you guys. JS interop in the early days was way less strict than it is now, it's kind of a surprise flutter took that turn.

I don't have resources to do it either, I'll be monitoring this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants