Hermes: Turn off annoying warnings on build

Created on 16 Apr 2020  路  7Comments  路  Source: facebook/hermes

Hello, how to turn off these annoying warnings on build with Hermes enabled?

I have some JSON files where I put translations there, and a LOT of warnings prompts on build, I thought was react-native loop issue but is just log from Hermes.

sample

 warning: The first definition was here.

Most helpful comment

In your project.ext.react you can add hermesFlagsRelease: ["-w"]

All 7 comments

What is the entire text of the warning?

What is the entire text of the warning?

@tmikov It prompts a chunk of minified code from index.android.bundle and shows warnings like ones in hermes file diagnode_errors.js for example:

//CHECK:{{.*}}warning: the property "color" was set multiple times in the object definition.
//CHECK-NEXT:var x = { color: 10, color: 20 };
//CHECK-NEXT:                            ^~
//CHECK-NEXT:{{.*}} warning: The first definition was here.
//CHECK-NEXT:var x = { color: 10, color: 20 };
//CHECK-NEXT:          ^~~~~~~~~

It is some similar warnings to https://github.com/facebook/react-native/issues/25599#issuecomment-510911486

Looks like these are legitimate warnings - the same property is being declared multiple times. I am curious - why is that desirable?

If you want to ignore them, you can pass the "-w" command line option to Hermes - it disables all warnings.

Looks like these are legitimate warnings - the same property is being declared multiple times. I am curious - why is that desirable?

If you want to ignore them, you can pass the "-w" command-line option to Hermes - it disables all warnings.

@tmikov, is because of I18n that I use consumes JSON, and as there is a term per language, when it bundles Hermes complains about that, that's why.

Do you know where I can put this command in React Native build process?

@iagormoraes RN runs the hermes compiler here: https://github.com/facebook/react-native/blob/992e0ce922cee91b079f8da7ce0e03ee2780b8c8/react.gradle#L189-L193

That's RN master, but whatever release you have should be similar.

In your project.ext.react you can add hermesFlagsRelease: ["-w"]

It worked guys, thank you so much!

Was this page helpful?
0 / 5 - 0 ratings