Unable to load source maps when dart web project is not hosted in root folder.
- Dominant language
- Dart
- Stars
- 224
- Forks
- 94
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 2
Description
Hi Team,
Our team migrated from the Google web tool kit to Dart recently.
Where
- v1 folder is legacy web project build using GWT framework
- v2 folder is migrated web project using Dart SDK.
Our web server hosts both versions from different folder paths.
We were trying the source mapping feature supported by webdev using command 'webdev build --no-release'
Unfortunately, the scripts were not imported properly due to the invalid import file path set by bootstrap.js & require.js.
On further debugging, I understood the issue is because of the baseUrl function which returns "/" instead of expected "/v2".
Reading through the documentation, I found some suggestions related to adding ``, which do resolve the issue, but caused page routing and image loading issues.
I was able to resolve the issue by returning "/v2" by default instead of "/" in baseUrl Function of generated bootstrap.js and require.js.
Hence I request the team to add an new command line argument to set baseUrl of project.
Ex: `webdev build --no-release --base-url="/v2"`
Contributor guide
Research direction
Start by reproducing the non-root deployment with `webdev build --no-release`, then inspect the generated `bootstrap.js` and `require.js` code where `baseUrl` is computed. The work is done when a build accepts the requested base URL, generates valid source-map imports under `/v2`, and does not require the conflicting `` workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- build-system, cli, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100