title: Ignore return outside of function with babel 7
body: <p>I recently updated to babel 7 and webpack 4 and am receiving this error when running our gulp build task:</p>
  
  <pre><code>gulp build
  [00:26:04] Requiring external module @babel/register
  [91m[BABEL] Note: The code generator has deoptimised the styling of /node_modules/lodash/lodash.js as it exceeds the max of 500KB.
  [0m[91m/node_modules/@babel/core/lib/parser/index.js:95
      throw err;
      ^
  
  SyntaxError: /node_modules/dev-ip/lib/dev-ip.js: 'return' outside of function (41:8)
  
    39 |     var out = getIp();
    40 |     if (!out.length) {
  &gt; 41 |         return console.log(messages.error);
       |         ^
    42 |     }
    43 |     console.log(getIp("cli"));
    44 | }
      at Parser.raise (/node_modules/@babel/parser/src/parser/location.js:41:63)
      at Parser.parseReturnStatement (/node_modules/@babel/parser/src/parser/statement.js:577:12)
      at Parser.parseStatementContent (/node_modules/@babel/parser/src/parser/statement.js:199:21)
      at Parser.parseStatement (/node_modules/@babel/parser/src/parser/statement.js:146:17)
      at Parser.parseBlockOrModuleBlockBody (/node_modules/@babel/parser/src/parser/statement.js:865:25)
      at Parser.parseBlockBody (/node_modules/@babel/parser/src/parser/statement.js:841:10)
      at Parser.parseBlock (/node_modules/@babel/parser/src/parser/statement.js:818:10)
      at Parser.parseStatementContent (/node_modules/@babel/parser/src/parser/statement.js:223:21)
      at Parser.parseStatement (/node_modules/@babel/parser/src/parser/statement.js:146:17)
      at Parser.parseIfStatement (/node_modules/@babel/parser/src/parser/statement.js:570:28)
  [0m[91merror Command failed with exit code 1.
  </code></pre>
  
  <p>This is caused by the return outside of a function in browser-syncs dev-ip dependency.</p>
  
  <p>Is there a way to configure my .babelrc file to ignore this?</p>
  
  <p>I've tried the following:</p>
  
  <ol>
  <li>Installing only production dependencies, but because browser sync is imported in my gulp file it's still being compiled</li>
  <li>Setting up workspaces with yarn, but similar issue as #1</li>
  <li>Dynamically importing browser sync in my gulp file, I guess this is not yet supported yet?</li>
  <li>Telling babel to ignore or exclude compiling the node_modules folder, but this doesn't seem to do anything?</li>
  </ol>
  
  <p>Apparently babel-parser has an option <code>allowReturnOutsideFunction: true</code>, but I can't figure out how to set this in my .babelrc file.</p>
  
  <p>Any thoughts on how to get around this?</p>