<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">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<p dir="auto">These seem related maybe?</p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="241313704" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/2499" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/2499/hovercard" href="https://github.com/vercel/next.js/issues/2499">#2499</a></li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="234454327" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/2197" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/2197/hovercard" href="https://github.com/vercel/next.js/issues/2197">#2197</a></li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">I should be able to add a <code class="notranslate">.babelrc</code> with a custom plugin and the <code class="notranslate">next/babel</code> preset and everything should work without having to include the <code class="notranslate">env</code> preset.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">When doing this I'm getting the following error when running tests (with Jest):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~/Developer/glamorous-with-next (pr/fix-config)
😇  $ npm run test --silent
 FAIL  components/__tests__/toggle-button.js
  ● Test suite failed to run

    /Users/kdodds/Developer/glamorous-with-next/components/__tests__/toggle-button.js:1
    ({&quot;Object.&lt;anonymous&gt;&quot;:function(module,exports,require,__dirname,__filename,global,jest){var _jsxFileName = '/Users/kdodds/Developer/glamorous-with-next/components/__tests__/toggle-button.js';import React from 'react';
                                                                                                                                                                                                    ^^^^^^
    
    SyntaxError: Unexpected token import
      
      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
          at &lt;anonymous&gt;
      at process._tickCallback (internal/process/next_tick.js:188:7)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.908s
Ran all test suites."><pre class="notranslate"><code class="notranslate">~/Developer/glamorous-with-next (pr/fix-config)
😇  $ npm run test --silent
 FAIL  components/__tests__/toggle-button.js
  ● Test suite failed to run

    /Users/kdodds/Developer/glamorous-with-next/components/__tests__/toggle-button.js:1
    ({"Object.&lt;anonymous&gt;":function(module,exports,require,__dirname,__filename,global,jest){var _jsxFileName = '/Users/kdodds/Developer/glamorous-with-next/components/__tests__/toggle-button.js';import React from 'react';
                                                                                                                                                                                                    ^^^^^^
    
    SyntaxError: Unexpected token import
      
      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
          at &lt;anonymous&gt;
      at process._tickCallback (internal/process/next_tick.js:188:7)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.908s
Ran all test suites.
</code></pre></div>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<p dir="auto">Run the following script (from a directory of your choosing):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mkdir next-preset-issue
cd next-preset-issue
npm init -y
npm install next react react-dom jest babel-preset-env --save
echo &quot;{\&quot;presets\&quot;: [\&quot;next/babel\&quot;]}&quot; &gt; .babelrc
echo &quot;import fs from 'fs';test('works', () =&gt; {});&quot; &gt; index.test.js
./node_modules/.bin/jest
echo &quot;{\&quot;presets\&quot;: [\&quot;next/babel\&quot;, \&quot;env\&quot;]}&quot; &gt; .babelrc
./node_modules/.bin/jest"><pre class="notranslate"><code class="notranslate">mkdir next-preset-issue
cd next-preset-issue
npm init -y
npm install next react react-dom jest babel-preset-env --save
echo "{\"presets\": [\"next/babel\"]}" &gt; .babelrc
echo "import fs from 'fs';test('works', () =&gt; {});" &gt; index.test.js
./node_modules/.bin/jest
echo "{\"presets\": [\"next/babel\", \"env\"]}" &gt; .babelrc
./node_modules/.bin/jest
</code></pre></div>
<p dir="auto">You'll notice that the first invocation of <code class="notranslate">jest</code> will fail with the error above, but the second (after adding the <code class="notranslate">env</code> preset has been added) will succeed.</p>
<h2 dir="auto">Context</h2>
<p dir="auto">I'm making a course for glamorous and I want to show how to do server rendering and testing. Next.js is the obvious choice, but I want to make sure I'm doing things properly and no more than necessary. If it's necessary to add the <code class="notranslate">env</code> preset that's fine, but I want to make sure that I understand why it's necessary.</p>
<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>v3.2.1</td>
</tr>
<tr>
<td>node</td>
<td>v8.3.0</td>
</tr>
<tr>
<td>OS</td>
<td>macOS</td>
</tr>
<tr>
<td>browser</td>
<td>N/A</td>
</tr>
</tbody>
</table>
<p dir="auto">Thanks!</p>
<p dir="auto">I am developing a nextjs app that runs on google cloud functions. Cloud functions requires node v.6.14.0 and the local function emulator needs v.6.14.0 as well. Since I upgraded to next 6, I am getting the following error when running the next dev server:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/project/node_modules/update-check/index.js:18
const getFile = async (details, distTag) =&gt; {
                      ^
SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Server._callee$ (/project/node_modules/next/dist/server/index.js:194:34)
 ...
"><pre class="notranslate"><code class="notranslate">/project/node_modules/update-check/index.js:18
const getFile = async (details, distTag) =&gt; {
                      ^
SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Server._callee$ (/project/node_modules/next/dist/server/index.js:194:34)
 ...

</code></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>
<p dir="auto">This is related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="319796448" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/4258" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/4258/hovercard" href="https://github.com/vercel/next.js/issues/4258">#4258</a>, but this has been closed because they could resolve the issue by updating the node version. However, I would like to keep the node version at v6.14 because I would like to keep my dev environment as close as possible to google cloud functions.</p>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">Should work as expected, like in next v5.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">Throws the error described above and does not start up the dev server.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Use Node v.6.14.0</li>
<li>Install Dependencies</li>
<li>run next</li>
</ol>
<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>6.0.0</td>
</tr>
<tr>
<td>node</td>
<td>6.14.0</td>
</tr>
<tr>
<td>OS</td>
<td>Arch Linux</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
</tbody>
</table>