My chatting application just broke. When I press Enter to send a message, it refreshes the page and navigates to ?. Then if I try again, it'll simply throw an exception:
EXCEPTION: TypeError: Instance of 'eE': type 'eE' is not a subtype of type 'minified:G'
I tried outputting SourceMaps by putting this in my build.yaml:
targets: $default: builders: build_web_compilers|dart_source_cleanup: release_options: enabled: false
It didn't work.
So I compiled with no obfuscation with this configuration:
targets: $default: builders: build_web_compilers|entrypoint: generate_for: - web/**.dart options: dart2js_args: - --no-minify - -O4
This time the error was readable:
EXCEPTION: NoSuchMethodError: method not found: 'preventDefault$0' (J.getInterceptor$x(...).preventDefault$0 is not a function) STACKTRACE: TypeError: J.getInterceptor$x(...).preventDefault$0 is not a function at Object.preventDefault$0$x (http://localhost:8080/main.dart.js:2952:43) at NgForm.onSubmit$1 (http://localhost:8080/main.dart.js:30792:11) at Object.eval (eval at Closure_forwardInterceptedCallTo (http://localhost:8080/main.dart.js:1431:14), <anonymous>:3:38) at RenderView_eventHandler1__closure.call$0 (http://localhost:8080/main.dart.js:28306:27)
I eventually found someone who posted the same issue at https://github.com/dart-lang/angular/issues/1889. It was filed 12 hours ago.
For now I found a workaround at https://stackoverflow.com/a/53954487, which is to not obfuscate by building using the following command:
webdev build --no-release
One caveat is that this version reads all of the files from
/build/packages, so you'll have to serve all these on your server. A second caveat is that the app will load
/require.js instead of
./require.js, meaning that you have to serve your webapp and
/packages at the root of your server.