Home > Software design >  Flutter build web in release mode
Flutter build web in release mode

Time:09-21

Is is possible to build flutter web in release mode? The only commmand I found to run on web was either :

flutter run -d chrome

but it's in debug

or I use : flutter run -d web-server --web-port 5000 --web-hostname localhost

to run a local webserver to avoid having to use a new chrome everytime I debug anything.

My problem is the following and pretty simple : I have code that crashes in release mode when webApp is built and deployed on github pages, but the stack is impossible to understand, also this very code doesn't crash when I test it in debug mode ( again the error stack looks like this ):

main.dart.js:4315 Uncaught TypeError: n.gawc is not a function
    at main.dart.js:22638:13
    at aAA.a (main.dart.js:5512:62)
    at aAA.$2 (main.dart.js:39196:14)
    at Object.E (main.dart.js:5498:10)
    at Object.QE (main.dart.js:22648:10)

the javascript is obfuscated so I don't know at which point it's hapenning, and if I want to test anything I need to build for web and upload on github pages, then wait 1 hour for it to be live to be able to see my prints in the console which are placed completely blind.

Is it possible to build for web in release mode locally?

Thank you for your time.

CodePudding user response:

Your question asks about building for web in release mode. So the following does that for you.

flutter build web --release

To actually run a local release version. You just need.

flutter run --release

See this for more info https://docs.flutter.dev/testing/build-modes

  • Related