Return inside if block
I use browser-sync which use your code as a dependency. When I transpile my code with babel6 a get this error: browser-sync/node_modules/dev-ip/lib/dev-ip.js: 'return' outside of function (41:8)
39 | var out = getIp();
40 | if (!out.length) {
> 41 | return console.log(messages.error);
| ^
42 | }
43 | console.log(getIp("cli"));
44 | }
If I remove return from the 41th line, everything is ok. Could you verify my statement or fix this issue. Thans a lot.
Why are compiling 3rd party code? You should be setting babel to ignore this surely?
Still you shouldn't put a return if it's not in a function. Why not put an if () {} else {} instead?
@OttlikG what did you do in the end? for k this library or find a way of ignoring it?
If you're using Yarn 2+ you can fix the problem by doing the following:
- Add
"dev-ip@^1.0.1": "patch:dev-ip@npm%3A1.0.1#./.yarn/patches/dev-ip-npm-1.0.1-6bbb9d1d09.patch"to theresolutionssection ofpackage.json - Add dev-ip-npm-1.0.1-6bbb9d1d09.patch to
./yarn/patches - Run
yarnto updateyarn.lock
Your build should now work.