Search code examples
ecmascript-6duplicatessyntax-errorbabeljsobject-literal

Efficiently find duplicate data property in object literal?


After creating our new system in Vue with babel, I have started testing compatibility towards older devices. Our babel is transpiling the source down to es2015 together with webpack.

I have now tested with browserstack against both Ios & android. Newer OS works on both platforms. However on android phones that use the default browser, I get an error in sentry stating; Duplicate data property in object literal not allowed in strict mode It does not give me any hints on where this might be thus making the debugging process painfully hard.

The only light in the end of the tunnel I can se now is the ios part. Ios devices that run IOS < 9 states an error Attempted to redefine property 'value'. also in sentry

If I am not mistaking, the ios issue is a reworded error of the same issue? As I read over here, I suppose 'value' might be defined twice in a object or element.

This all wraps up to the question, how does one go with finding duplicate data properties?


Solution

  • I managed to find out what line the error occurred on and found out that a plugin that I used with name Vue-numeric had created a duplicate value:

     domProps: {
       value: n.value,
       value: n.amount
     },
    

    I had accidentally locked the plugin on a older version where this problem was present. The issue was fixed by simply updating.

    Thank you @xenetics for taking your time on this issue.