Unverified Commit 034adb66 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

[tool,web] Include more info URI on Wasm init failure (#125312)

parent 9e2e64c7
...@@ -14,6 +14,7 @@ import '../runner/flutter_command.dart' ...@@ -14,6 +14,7 @@ import '../runner/flutter_command.dart'
show DevelopmentArtifact, FlutterCommandResult, FlutterOptions; show DevelopmentArtifact, FlutterCommandResult, FlutterOptions;
import '../web/compile.dart'; import '../web/compile.dart';
import '../web/file_generators/flutter_service_worker_js.dart'; import '../web/file_generators/flutter_service_worker_js.dart';
import '../web/web_constants.dart';
import 'build.dart'; import 'build.dart';
class BuildWebCommand extends BuildSubCommand { class BuildWebCommand extends BuildSubCommand {
...@@ -91,7 +92,7 @@ class BuildWebCommand extends BuildSubCommand { ...@@ -91,7 +92,7 @@ class BuildWebCommand extends BuildSubCommand {
} }
argParser.addFlag( argParser.addFlag(
FlutterOptions.kWebWasmFlag, FlutterOptions.kWebWasmFlag,
help: 'Compile to WebAssembly rather than JavaScript.\nSee $kWasmPreviewUri for more information.', help: 'Compile to WebAssembly rather than JavaScript.\n$kWasmMoreInfo',
negatable: false, negatable: false,
hide: !featureFlags.isFlutterWebWasmEnabled, hide: !featureFlags.isFlutterWebWasmEnabled,
); );
......
...@@ -24,6 +24,7 @@ import '../version.dart'; ...@@ -24,6 +24,7 @@ import '../version.dart';
import 'compiler_config.dart'; import 'compiler_config.dart';
import 'file_generators/flutter_service_worker_js.dart'; import 'file_generators/flutter_service_worker_js.dart';
import 'migrations/scrub_generated_plugin_registrant.dart'; import 'migrations/scrub_generated_plugin_registrant.dart';
import 'web_constants.dart';
export 'compiler_config.dart'; export 'compiler_config.dart';
...@@ -63,7 +64,7 @@ class WebBuilder { ...@@ -63,7 +64,7 @@ class WebBuilder {
title: 'Experimental feature', title: 'Experimental feature',
''' '''
WebAssembly compilation is experimental. WebAssembly compilation is experimental.
See $kWasmPreviewUri for more information.''', $kWasmMoreInfo''',
); );
} }
...@@ -224,8 +225,6 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtif ...@@ -224,8 +225,6 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtif
}, },
}; };
const String kWasmPreviewUri = 'https://flutter.dev/wasm';
String _buildEventAnalyticsSettings({ String _buildEventAnalyticsSettings({
required WebCompilerConfig config, required WebCompilerConfig config,
required BuildInfo buildInfo, required BuildInfo buildInfo,
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import '../web_constants.dart';
String generateWasmBootstrapFile(bool isSkwasm) { String generateWasmBootstrapFile(bool isSkwasm) {
return ''' return '''
// Copyright 2014 The Flutter Authors. All rights reserved. // Copyright 2014 The Flutter Authors. All rights reserved.
...@@ -18,6 +20,7 @@ String generateWasmBootstrapFile(bool isSkwasm) { ...@@ -18,6 +20,7 @@ String generateWasmBootstrapFile(bool isSkwasm) {
moduleInstance = await dart2wasm_runtime.instantiate(dartModulePromise, imports); moduleInstance = await dart2wasm_runtime.instantiate(dartModulePromise, imports);
} catch (exception) { } catch (exception) {
console.error(`Failed to fetch and instantiate wasm module: \${exception}`); console.error(`Failed to fetch and instantiate wasm module: \${exception}`);
console.error('$kWasmMoreInfo');
} }
if (moduleInstance) { if (moduleInstance) {
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const String kWasmMoreInfo = 'See https://flutter.dev/wasm for more information.';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment