<p dir="auto">Looks like the <a href="https://github.com/zeit/next.js/blob/master/server/build/webpack.js#L100"><code class="notranslate">babel-runtime</code> alias in the webpack config</a> is causing babel to transpile incorrectly. Any async function defined on the module fails because <code class="notranslate">_regenerator2</code> is <code class="notranslate">undefined</code>. If the aysnc function is defined within a class, like with <code class="notranslate">getInitialProps</code>, everything works. Without the alias everything appears to work. I'm using <code class="notranslate">next@1.1.0</code>.</p>
<h5 dir="auto">pages/index.js</h5>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="async function test() {
  
}"><pre class="notranslate"><span class="pl-k">async</span> <span class="pl-k">function</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  
<span class="pl-kos">}</span></pre></div>
<h5 dir="auto">throws:</h5>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="TypeError: Cannot read property 'default' of undefined
    at /Users/amccloud/Labs/Auth0/next-auth0/.next/dist/pages/index.js:4:36
    at Object.&lt;anonymous&gt; (/Users/amccloud/Labs/Auth0/next-auth0/.next/dist/pages/index.js:19:2)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at _callee$ (/Users/amccloud/Labs/Auth0/next-auth0/node_modules/next/dist/server/require.js:33:46)"><pre class="notranslate">TypeError: <span class="pl-v">Cannot</span> <span class="pl-s1">read</span> <span class="pl-s1">property</span> <span class="pl-s">'default'</span> <span class="pl-s1">of</span> <span class="pl-c1">undefined</span>
    <span class="pl-s1">at</span> <span class="pl-c1">/</span><span class="pl-v">Users</span><span class="pl-c1">/</span><span class="pl-s1">amccloud</span><span class="pl-c1">/</span><span class="pl-v">Labs</span><span class="pl-c1">/</span><span class="pl-v">Auth0</span><span class="pl-c1">/</span><span class="pl-s1">next</span><span class="pl-c1">-</span><span class="pl-s1">auth0</span><span class="pl-c1">/</span><span class="pl-kos">.</span><span class="pl-c1">next</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">/</span><span class="pl-s1">pages</span><span class="pl-c1">/</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">4</span>:<span class="pl-c1">36</span>
    <span class="pl-s1">at</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-c1">&lt;</span><span class="pl-s1">anonymous</span><span class="pl-c1">&gt;</span> <span class="pl-kos">(</span><span class="pl-pds"><span class="pl-c1">/</span>Users<span class="pl-c1">/</span>amccloud</span><span class="pl-c1">/</span><span class="pl-v">Labs</span><span class="pl-c1">/</span><span class="pl-v">Auth0</span><span class="pl-c1">/</span><span class="pl-s1">next</span><span class="pl-c1">-</span><span class="pl-s1">auth0</span><span class="pl-c1">/</span><span class="pl-kos">.</span><span class="pl-c1">next</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">/</span><span class="pl-s1">pages</span><span class="pl-c1">/</span><span class="pl-s1">index</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">19</span>:<span class="pl-c1">2</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-v">Module</span><span class="pl-kos">.</span><span class="pl-en">_compile</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">556</span>:<span class="pl-c1">32</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-c1">Module</span><span class="pl-kos">.</span><span class="pl-c1">_extensions</span><span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-en">js</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">565</span>:<span class="pl-c1">10</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-v">Module</span><span class="pl-kos">.</span><span class="pl-en">load</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">473</span>:<span class="pl-c1">32</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span><span class="pl-kos"></span> <span class="pl-en">tryModuleLoad</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">432</span>:<span class="pl-c1">12</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-v">Function</span><span class="pl-kos">.</span><span class="pl-c1">Module</span><span class="pl-kos">.</span><span class="pl-en">_load</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">424</span>:<span class="pl-c1">3</span><span class="pl-kos">)</span>
    <span class="pl-s1">at</span> <span class="pl-v">Module</span><span class="pl-kos">.</span><span class="pl-en">require</span> <span class="pl-kos">(</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">483</span>:<span class="pl-c1">17</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-en">require</span> <span class="pl-kos">(</span><span class="pl-s1">internal</span><span class="pl-c1">/</span><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">20</span>:<span class="pl-c1">19</span><span class="pl-kos">)</span>
    <span class="pl-en">at</span> <span class="pl-s1">_callee$</span> <span class="pl-kos">(</span><span class="pl-pds"><span class="pl-c1">/</span>Users<span class="pl-c1">/</span>amccloud</span><span class="pl-c1">/</span><span class="pl-v">Labs</span><span class="pl-c1">/</span><span class="pl-v">Auth0</span><span class="pl-c1">/</span><span class="pl-s1">next</span><span class="pl-c1">-</span><span class="pl-s1">auth0</span><span class="pl-c1">/</span><span class="pl-s1">node_modules</span><span class="pl-c1">/</span><span class="pl-s1">next</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">/</span><span class="pl-s1">server</span><span class="pl-c1">/</span><span class="pl-en">require</span><span class="pl-kos">.</span><span class="pl-c1">js</span>:<span class="pl-c1">33</span>:<span class="pl-c1">46</span><span class="pl-kos">)</span></pre></div>
<h5 dir="auto">with <code class="notranslate">babel-runtime</code> alias</h5>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

Object.defineProperty(exports, &quot;__esModule&quot;, {
  value: true
});
exports.test = undefined;

var test = exports.test = function () {
  var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() { // _regenerator2 undefined
    return _regenerator2.default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
          case &quot;end&quot;:
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  return function test() {
    return _ref.apply(this, arguments);
  };
}();

var _regenerator = require(&quot;/Users/amccloud/Labs/Auth0/next-auth0/node_modules/babel-runtime/regenerator&quot;);

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require(&quot;/Users/amccloud/Labs/Auth0/next-auth0/node_modules/babel-runtime/helpers/asyncToGenerator&quot;);

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>

<span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">defineProperty</span><span class="pl-kos">(</span><span class="pl-s1">exports</span><span class="pl-kos">,</span> <span class="pl-s">"__esModule"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">value</span>: <span class="pl-c1">true</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">test</span> <span class="pl-c1">=</span> <span class="pl-c1">undefined</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">test</span> <span class="pl-c1">=</span> <span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">test</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">var</span> <span class="pl-s1">_ref</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">_asyncToGenerator3</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-s1">_regenerator2</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">.</span><span class="pl-en">mark</span><span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-en">_callee</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-c">// _regenerator2 undefined</span>
    <span class="pl-k">return</span> <span class="pl-s1">_regenerator2</span><span class="pl-kos">.</span><span class="pl-c1">default</span><span class="pl-kos">.</span><span class="pl-en">wrap</span><span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-en">_callee$</span><span class="pl-kos">(</span><span class="pl-s1">_context</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">while</span> <span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">switch</span> <span class="pl-kos">(</span><span class="pl-s1">_context</span><span class="pl-kos">.</span><span class="pl-c1">prev</span> <span class="pl-c1">=</span> <span class="pl-s1">_context</span><span class="pl-kos">.</span><span class="pl-c1">next</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
          <span class="pl-k">case</span> <span class="pl-c1">0</span>:
          <span class="pl-k">case</span> <span class="pl-s">"end"</span>:
            <span class="pl-k">return</span> <span class="pl-s1">_context</span><span class="pl-kos">.</span><span class="pl-en">stop</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
      <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-s1">_callee</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">return</span> <span class="pl-k">function</span> <span class="pl-s1">test</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-s1">_ref</span><span class="pl-kos">.</span><span class="pl-en">apply</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-smi">arguments</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">_regenerator</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">"/Users/amccloud/Labs/Auth0/next-auth0/node_modules/babel-runtime/regenerator"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">_regenerator2</span> <span class="pl-c1">=</span> <span class="pl-en">_interopRequireDefault</span><span class="pl-kos">(</span><span class="pl-s1">_regenerator</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">_asyncToGenerator2</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">"/Users/amccloud/Labs/Auth0/next-auth0/node_modules/babel-runtime/helpers/asyncToGenerator"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">_asyncToGenerator3</span> <span class="pl-c1">=</span> <span class="pl-en">_interopRequireDefault</span><span class="pl-kos">(</span><span class="pl-s1">_asyncToGenerator2</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">function</span> <span class="pl-en">_interopRequireDefault</span><span class="pl-kos">(</span><span class="pl-s1">obj</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-k">return</span> <span class="pl-s1">obj</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-s1">obj</span><span class="pl-kos">.</span><span class="pl-c1">__esModule</span> ? <span class="pl-s1">obj</span> : <span class="pl-kos">{</span> <span class="pl-c1">default</span>: <span class="pl-s1">obj</span> <span class="pl-kos">}</span><span class="pl-kos">;</span> <span class="pl-kos">}</span></pre></div>
<h5 dir="auto">without <code class="notranslate">babel-runtime</code> alias</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

Object.defineProperty(exports, &quot;__esModule&quot;, {
  value: true
});
exports.test = undefined;

var _regenerator = require(&quot;babel-runtime/regenerator&quot;);

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require(&quot;babel-runtime/helpers/asyncToGenerator&quot;);

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

var test = exports.test = function () {
  var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
    return _regenerator2.default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
          case &quot;end&quot;:
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  return function test() {
    return _ref.apply(this, arguments);
  };
}();

function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }"><pre class="notranslate"><code class="notranslate">"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.test = undefined;

var _regenerator = require("babel-runtime/regenerator");

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

var test = exports.test = function () {
  var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
    return _regenerator2.default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
          case "end":
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  return function test() {
    return _ref.apply(this, arguments);
  };
}();

function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
</code></pre></div>
<h5 dir="auto">possibly related issues</h5>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="186226789" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/168" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/168/hovercard" href="https://github.com/vercel/next.js/issues/168">#168</a></li>
</ul>
<p dir="auto">Hey guys, when I try to implement a custom .babelrc with next.config.js, I get a build error and it looks like its ignoring React Components (JSX).</p>
<p dir="auto">.babelrc:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [
    &quot;next/babel&quot;
  ],
  &quot;plugins&quot;: [
    [&quot;transform-define&quot;, &quot;./env-config.js&quot;]
  ],
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"presets"</span>: <span class="pl-kos">[</span>
    <span class="pl-s">"next/babel"</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">"transform-define"</span><span class="pl-kos">,</span> <span class="pl-s">"./env-config.js"</span><span class="pl-kos">]</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">next.config.js:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// next.config.js

const webpack = require(&quot;webpack&quot;)
const withCSS = require('@zeit/next-css')

// Update these to match your package scope name.
const internalNodeModulesRegExp = /src(?!\/(?!.*js))/
const externalNodeModulesRegExp = /node_modules(?!\/@zeit(?!.*node_modules))/

module.exports = withCSS({
  useFileSystemPublicRoutes: false,
  webpack: (config, { dev, isServer, defaultLoaders }) =&gt; {
    config.resolve.symlinks = false
    config.externals = config.externals.map(external =&gt; {
      if (typeof external !== &quot;function&quot;) return external
      return (ctx, req, cb) =&gt; (internalNodeModulesRegExp.test(req) ? cb() : external(ctx, req, cb))
    })
    config.module.rules.push({
      test: [
        /\.gif$/,
        /\.jpe?g$/,
        /\.png$/,
        /\.svg$/,
      ],

      use: {
        loader: 'file-loader',
        options: {}  
      }
    });
    console.log(defaultLoaders);
    config.module.rules.push({
      test: /\.+(js|jsx)$/,
      use: defaultLoaders.babel,
      include: [internalNodeModulesRegExp],
    })
    return config
  },
  webpackDevMiddleware: config =&gt; {
    const ignored = [config.watchOptions.ignored[0], externalNodeModulesRegExp]
    config.watchOptions.ignored = ignored
    config.stats = {
      warnings: false,
    };
    return config
  },
  distDir: 'next_build'
});"><pre class="notranslate"><span class="pl-c">// next.config.js</span>

<span class="pl-k">const</span> <span class="pl-s1">webpack</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">"webpack"</span><span class="pl-kos">)</span>
<span class="pl-k">const</span> <span class="pl-s1">withCSS</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'@zeit/next-css'</span><span class="pl-kos">)</span>

<span class="pl-c">// Update these to match your package scope name.</span>
<span class="pl-k">const</span> <span class="pl-s1">internalNodeModulesRegExp</span> <span class="pl-c1">=</span> <span class="pl-pds"><span class="pl-c1">/</span>src<span class="pl-kos">(?</span><span class="pl-c1">!</span><span class="pl-cce">\/</span><span class="pl-kos">(?</span><span class="pl-c1">!</span>.<span class="pl-c1">*</span>js<span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-c1">/</span></span>
<span class="pl-k">const</span> <span class="pl-s1">externalNodeModulesRegExp</span> <span class="pl-c1">=</span> <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-kos">(?</span><span class="pl-c1">!</span><span class="pl-cce">\/</span>@zeit<span class="pl-kos">(?</span><span class="pl-c1">!</span>.<span class="pl-c1">*</span>node_modules<span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-c1">/</span></span>

<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-s1">withCSS</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">useFileSystemPublicRoutes</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
  <span class="pl-en">webpack</span>: <span class="pl-kos">(</span><span class="pl-s1">config</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> dev<span class="pl-kos">,</span> isServer<span class="pl-kos">,</span> defaultLoaders <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">resolve</span><span class="pl-kos">.</span><span class="pl-c1">symlinks</span> <span class="pl-c1">=</span> <span class="pl-c1">false</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">externals</span> <span class="pl-c1">=</span> <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">externals</span><span class="pl-kos">.</span><span class="pl-en">map</span><span class="pl-kos">(</span><span class="pl-s1">external</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
      <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-k">typeof</span> <span class="pl-s1">external</span> <span class="pl-c1">!==</span> <span class="pl-s">"function"</span><span class="pl-kos">)</span> <span class="pl-k">return</span> <span class="pl-s1">external</span>
      <span class="pl-k">return</span> <span class="pl-kos">(</span><span class="pl-s1">ctx</span><span class="pl-kos">,</span> <span class="pl-s1">req</span><span class="pl-kos">,</span> <span class="pl-s1">cb</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">(</span><span class="pl-s1">internalNodeModulesRegExp</span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s1">req</span><span class="pl-kos">)</span> ? <span class="pl-s1">cb</span><span class="pl-kos">(</span><span class="pl-kos">)</span> : <span class="pl-en">external</span><span class="pl-kos">(</span><span class="pl-s1">ctx</span><span class="pl-kos">,</span> <span class="pl-s1">req</span><span class="pl-kos">,</span> <span class="pl-s1">cb</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">module</span><span class="pl-kos">.</span><span class="pl-c1">rules</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
      <span class="pl-c1">test</span>: <span class="pl-kos">[</span>
        <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span>gif<span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span>jpe?g<span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span>png<span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span>svg<span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>

      <span class="pl-c1">use</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">loader</span>: <span class="pl-s">'file-loader'</span><span class="pl-kos">,</span>
        <span class="pl-c1">options</span>: <span class="pl-kos">{</span><span class="pl-kos">}</span>  
      <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">defaultLoaders</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">module</span><span class="pl-kos">.</span><span class="pl-c1">rules</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
      <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-c1">+</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
      <span class="pl-c1">use</span>: <span class="pl-s1">defaultLoaders</span><span class="pl-kos">.</span><span class="pl-c1">babel</span><span class="pl-kos">,</span>
      <span class="pl-c1">include</span>: <span class="pl-kos">[</span><span class="pl-s1">internalNodeModulesRegExp</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span>
    <span class="pl-k">return</span> <span class="pl-s1">config</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-en">webpackDevMiddleware</span>: <span class="pl-s1">config</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">const</span> <span class="pl-s1">ignored</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">watchOptions</span><span class="pl-kos">.</span><span class="pl-c1">ignored</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-s1">externalNodeModulesRegExp</span><span class="pl-kos">]</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">watchOptions</span><span class="pl-kos">.</span><span class="pl-c1">ignored</span> <span class="pl-c1">=</span> <span class="pl-s1">ignored</span>
    <span class="pl-s1">config</span><span class="pl-kos">.</span><span class="pl-c1">stats</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
      <span class="pl-c1">warnings</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-k">return</span> <span class="pl-s1">config</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">distDir</span>: <span class="pl-s">'next_build'</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Current Behavior</h2>


<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="BabelLoaderError: SyntaxError: Unexpected token (10:4)

   8 | const NavList = ({activeLinkClass, horizontal, items, title, showIcon, styles, ssr}) =&gt; {
   9 |   return (
&gt; 10 |     &lt;nav className={css(baseStyles.nav, styles.container)}&gt;
     |     ^
  11 |       {title &amp;&amp; (
  12 |         &lt;h1 className={css(baseStyles.title, styles.title)}&gt;{title}&lt;/h1&gt;
  13 |       )}

    at transpile (/Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/index.js:65:13)
    at /Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/fs-cache.js:118:18
    at ReadFileContext.callback (/Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:419:13)
 @ ../src/containers/components/base/index.js 17:0-47
 @ ./pages/ReaderPage.js
 @ multi ./pages/ReaderPage.js
"><pre class="notranslate">BabelLoaderError: SyntaxError: <span class="pl-v">Unexpected</span> <span class="pl-s1">token</span> <span class="pl-kos">(</span><span class="pl-c1">10</span>:<span class="pl-c1">4</span><span class="pl-kos">)</span>

   <span class="pl-c1">8</span> <span class="pl-c1">|</span> <span class="pl-s1">const</span> <span class="pl-v">NavList</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">{</span>activeLinkClass<span class="pl-kos">,</span> horizontal<span class="pl-kos">,</span> items<span class="pl-kos">,</span> title<span class="pl-kos">,</span> showIcon<span class="pl-kos">,</span> styles<span class="pl-kos">,</span> ssr<span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
   <span class="pl-c1">9</span> <span class="pl-c1">|</span>   <span class="pl-s1">return</span> <span class="pl-kos">(</span>
<span class="pl-c1">&gt;</span> <span class="pl-c1">10</span> <span class="pl-c1">|</span>     <span class="pl-c1">&lt;</span><span class="pl-ent">nav</span> <span class="pl-c1">className</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-en">css</span><span class="pl-kos">(</span><span class="pl-s1">baseStyles</span><span class="pl-kos">.</span><span class="pl-c1">nav</span><span class="pl-kos">,</span> <span class="pl-s1">styles</span><span class="pl-kos">.</span><span class="pl-c1">container</span><span class="pl-kos">)</span><span class="pl-kos">}</span><span class="pl-c1">&gt;</span>
     |     ^
  11 |       <span class="pl-kos">{</span><span class="pl-s1">title</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-kos">(</span>
  <span class="pl-c1">12</span> <span class="pl-c1">|</span>         <span class="pl-c1">&lt;</span><span class="pl-ent">h1</span> <span class="pl-c1">className</span><span class="pl-c1">=</span><span class="pl-kos">{</span><span class="pl-en">css</span><span class="pl-kos">(</span><span class="pl-s1">baseStyles</span><span class="pl-kos">.</span><span class="pl-c1">title</span><span class="pl-kos">,</span> <span class="pl-s1">styles</span><span class="pl-kos">.</span><span class="pl-c1">title</span><span class="pl-kos">)</span><span class="pl-kos">}</span><span class="pl-c1">&gt;</span><span class="pl-kos">{</span><span class="pl-s1">title</span><span class="pl-kos">}</span><span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">h1</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">13</span> <span class="pl-c1">|</span><span class="pl-s1"></span>       <span class="pl-kos">)</span><span class="pl-kos">}</span>

    at transpile (/Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/index.js:65:13)
    at /Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/fs-cache.js:118:18
    at ReadFileContext.callback (/Users/patricklu/Q5/lunyr/Lunyr-Frontend/server/node_modules/babel-loader/lib/fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:419:13)
 @ ../src/containers/components/base/index.js 17:0-47
 @ ./pages/ReaderPage.js
 @ multi ./pages/ReaderPage.js</pre></div>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>v5.0.0</td>
</tr>
<tr>
<td>node</td>
<td>v8.1.2</td>
</tr>
<tr>
<td>OS</td>
<td>macOs</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
</tbody>
</table>