[tool,web] Include more info URI on Wasm init failure (#125312)
This commit is contained in:
@@ -14,6 +14,7 @@ import '../runner/flutter_command.dart'
|
||||
show DevelopmentArtifact, FlutterCommandResult, FlutterOptions;
|
||||
import '../web/compile.dart';
|
||||
import '../web/file_generators/flutter_service_worker_js.dart';
|
||||
import '../web/web_constants.dart';
|
||||
import 'build.dart';
|
||||
|
||||
class BuildWebCommand extends BuildSubCommand {
|
||||
@@ -91,7 +92,7 @@ class BuildWebCommand extends BuildSubCommand {
|
||||
}
|
||||
argParser.addFlag(
|
||||
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,
|
||||
hide: !featureFlags.isFlutterWebWasmEnabled,
|
||||
);
|
||||
|
||||
@@ -24,6 +24,7 @@ import '../version.dart';
|
||||
import 'compiler_config.dart';
|
||||
import 'file_generators/flutter_service_worker_js.dart';
|
||||
import 'migrations/scrub_generated_plugin_registrant.dart';
|
||||
import 'web_constants.dart';
|
||||
|
||||
export 'compiler_config.dart';
|
||||
|
||||
@@ -63,7 +64,7 @@ class WebBuilder {
|
||||
title: 'Experimental feature',
|
||||
'''
|
||||
WebAssembly compilation is experimental.
|
||||
See $kWasmPreviewUri for more information.''',
|
||||
$kWasmMoreInfo''',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,8 +225,6 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtif
|
||||
},
|
||||
};
|
||||
|
||||
const String kWasmPreviewUri = 'https://flutter.dev/wasm';
|
||||
|
||||
String _buildEventAnalyticsSettings({
|
||||
required WebCompilerConfig config,
|
||||
required BuildInfo buildInfo,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import '../web_constants.dart';
|
||||
|
||||
String generateWasmBootstrapFile(bool isSkwasm) {
|
||||
return '''
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
@@ -18,6 +20,7 @@ String generateWasmBootstrapFile(bool isSkwasm) {
|
||||
moduleInstance = await dart2wasm_runtime.instantiate(dartModulePromise, imports);
|
||||
} catch (exception) {
|
||||
console.error(`Failed to fetch and instantiate wasm module: \${exception}`);
|
||||
console.error('$kWasmMoreInfo');
|
||||
}
|
||||
|
||||
if (moduleInstance) {
|
||||
|
||||
5
packages/flutter_tools/lib/src/web/web_constants.dart
Normal file
5
packages/flutter_tools/lib/src/web/web_constants.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
// 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.';
|
||||
Reference in New Issue
Block a user