cunarist / rinf

Rust for native business logic, Flutter for flexible and beautiful GUI
MIT License
1.98k stars 70 forks source link

loading hub.js does not consider base href #298

Closed ArinFaraj closed 4 months ago

ArinFaraj commented 8 months ago

When building a Flutter web project with --base-href set to a different path, the following line does not consider it and fails as the file is supposed to be in the different path.

https://github.com/cunarist/rinf/blob/d8e012ca89eb53722f24c2f94489266bdc413746/flutter_ffi_plugin/lib/src/load_web.dart#L23

building a flutter project with flutter build web --release --base-href /new/ will set the base element to <base href="/new/"> in the index.html file. I have not tested it because I am now a little busy, but perhaps making the /pkg/hub.js path relative pkg/hub.js will resolve the problem.

temeddix commented 8 months ago

Hello @ArinFaraj , thanks for leaving your valuable opinion.

Yeah, it would be very nice to support subpaths on the web. As you said, it doesn't seem to be so hard to implement. I will look into this when I have time later. Meanwhile, any PR is welcome :)

temeddix commented 8 months ago

I've been testing this issue for a while, and it looks like tokio_with_wasm should be also modified for base-href. It should be applied to both of these projects.