webdev icon indicating copy to clipboard operation
webdev copied to clipboard

dart.vm.product is not set to true in --release builds

Open eseidel opened this issue 3 years ago • 1 comments

Flutter seems to have landed on using dart.vm.product to indicate release mode.

https://api.flutter.dev/flutter/foundation/kReleaseMode-constant.html

How Flutter sets it: https://github.com/flutter/flutter/blob/b7c500fc6bf04e44156722cd053020595d1fbd35/packages/flutter_tools/lib/src/compile.dart#L197

I was looking for something similar for "dart web" builds, and failed to find such. Would be nice if the Flutter way worked for webdev build --release or at least if some way worked. :)

eseidel avatar Sep 05 '22 23:09 eseidel

Adding a build.yaml with:

targets:
  $default:
    builders:
      build_web_compilers:entrypoint:
        release_options:
          dart2js_args:
           - '-Ddart.vm.product=true'

appears to be the necessary magic. :)

eseidel avatar Sep 05 '22 23:09 eseidel