Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a7f9ebcc
Unverified
Commit
a7f9ebcc
authored
Mar 03, 2023
by
Kevin Moore
Committed by
GitHub
Mar 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize CLI flags for `build web` (#121837)
Reorganize CLI flags for `build web`
parent
9cb7a151
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
30 deletions
+44
-30
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+44
-30
No files found.
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
a7f9ebcc
...
...
@@ -28,35 +28,20 @@ class BuildWebCommand extends BuildSubCommand {
usesBuildNameOption
();
addBuildModeFlags
(
verboseHelp:
verboseHelp
,
excludeDebug:
true
);
usesDartDefineOption
();
usesWebRendererOption
();
addEnableExperimentation
(
hide:
!
verboseHelp
);
addNullSafetyModeOptions
(
hide:
!
verboseHelp
);
addNativeNullAssertions
();
argParser
.
addFlag
(
'csp'
,
negatable:
false
,
help:
'Disable dynamic generation of code in the generated output. '
'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
);
argParser
.
addFlag
(
'source-maps'
,
help:
'Generate a sourcemap file. These can be used by browsers '
'to view and debug the original source code of a compiled and minified Dart '
'application.'
);
if
(
featureFlags
.
isFlutterWebWasmEnabled
)
{
argParser
.
addFlag
(
'wasm'
,
help:
'Compile to WebAssembly rather than JavaScript (experimental).'
,
);
}
else
{
// Add the flag as hidden. Will give a helpful error message in [runCommand] below.
argParser
.
addFlag
(
'wasm'
,
hide:
true
,
);
}
//
// Flutter web-specific options
//
argParser
.
addSeparator
(
'Flutter web options'
);
argParser
.
addOption
(
'base-href'
,
help:
'Overrides the href attribute of the <base> tag in web/index.html. '
'No change is done to web/index.html file if this flag is not provided. '
'The value has to start and end with a slash "/". '
'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
);
argParser
.
addOption
(
'pwa-strategy'
,
defaultsTo:
kOfflineFirst
,
help:
'The caching strategy to be used by the PWA service worker.'
,
...
...
@@ -74,11 +59,22 @@ class BuildWebCommand extends BuildSubCommand {
'is not desirable'
,
},
);
argParser
.
addOption
(
'base-href'
,
help:
'Overrides the href attribute of the <base> tag in web/index.html. '
'No change is done to web/index.html file if this flag is not provided. '
'The value has to start and end with a slash "/". '
'For more information: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base'
usesWebRendererOption
();
//
// JavaScript compilation options
//
argParser
.
addSeparator
(
'JavaScript compilation options'
);
argParser
.
addFlag
(
'csp'
,
negatable:
false
,
help:
'Disable dynamic generation of code in the generated output. '
'This is necessary to satisfy CSP restrictions (see http://www.w3.org/TR/CSP/).'
);
argParser
.
addFlag
(
'source-maps'
,
help:
'Generate a sourcemap file. These can be used by browsers '
'to view and debug the original source code of a compiled and minified Dart '
'application.'
);
argParser
.
addOption
(
'dart2js-optimization'
,
help:
'Sets the optimization level used for Dart compilation to JavaScript. '
...
...
@@ -93,6 +89,24 @@ class BuildWebCommand extends BuildSubCommand {
help:
'Disables the frequency based minifier. '
'Useful for comparing the output between builds.'
);
//
// Experimental options
//
if
(
featureFlags
.
isFlutterWebWasmEnabled
)
{
argParser
.
addSeparator
(
'Experimental options'
);
argParser
.
addFlag
(
'wasm'
,
help:
'Compile to WebAssembly rather than JavaScript.'
,
negatable:
false
,
);
}
else
{
// Add the flag as hidden. Will give a helpful error message in [runCommand] below.
argParser
.
addFlag
(
'wasm'
,
hide:
true
,
);
}
}
final
FileSystem
_fileSystem
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment