Copy over source maps from dart2js target when they are enabled. (#144832)

This fixes https://github.com/flutter/flutter/issues/143703

We need to make sure that when source maps are enabled for the dart2js target, it advertises the sourcemap file as one of its outputs so that the web release bundle can copy it over.
This commit is contained in:
Jackson Gardner 2024-03-08 10:56:18 -08:00 committed by GitHub
parent ea1ef751e0
commit 074114b85a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -231,6 +231,7 @@ class Dart2JSTarget extends Dart2WebTarget {
@override
List<String> get buildFiles => <String>[
'main.dart.js',
if (compilerConfig.sourceMaps) 'main.dart.js.map',
];
}

View file

@ -182,6 +182,7 @@ void main() {
webResources.childFile('foo.txt')
.writeAsStringSync('A');
environment.buildDir.childFile('main.dart.js').createSync();
environment.buildDir.childFile('main.dart.js.map').createSync();
await WebReleaseBundle(<WebCompilerConfig>[
const JsCompilerConfig()
@ -191,6 +192,8 @@ void main() {
.readAsStringSync(), 'A');
expect(environment.outputDir.childFile('main.dart.js')
.existsSync(), true);
expect(environment.outputDir.childFile('main.dart.js.map')
.existsSync(), true);
expect(environment.outputDir.childDirectory('assets')
.childFile('AssetManifest.bin.json').existsSync(), true);