dart-lang / dart-lang/webdev

Unable to load source maps when dart web project is not hosted in root folder.

Open
#2,353 2 comments 0 reactions 0 assignees View on GitHub
good first issue P3 package:webdev triaged type-enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.