Skip to content

Commit

Permalink
Copy over source maps from dart2js target when they are enabled. (#14…
Browse files Browse the repository at this point in the history
…4832)

This fixes flutter/flutter#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.
  • Loading branch information
eyebrowsoffire authored Mar 8, 2024
1 parent ea1ef75 commit 074114b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ class Dart2JSTarget extends Dart2WebTarget {
@override
List<String> get buildFiles => <String>[
'main.dart.js',
if (compilerConfig.sourceMaps) 'main.dart.js.map',
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);

Expand Down

0 comments on commit 074114b

Please sign in to comment.