<h1 dir="auto">Bug report</h1>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">When I run <code class="notranslate">npm install</code> it runs through fine, then i start my app using <code class="notranslate">npm run dev</code> and browse to a page and that is when I see the error message.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/home/metzger/projects/maketube/frontend/node_modules/@babel/runtime-corejs2/helpers/esm/typeof.js:1
(function (exports, require, module, __filename, __dirname) { import _Symbol$iterator from &quot;../../core-js/symbol/iterator&quot;;
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._compile (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:104:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.&lt;anonymous&gt; (/home/metzger/projects/maketube/frontend/.next/server/static/development/pages/_error.js:7:39)
    at Module._compile (module.js:652:30)
    at Module._compile (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:104:7)
"><pre class="notranslate"><code class="notranslate">/home/metzger/projects/maketube/frontend/node_modules/@babel/runtime-corejs2/helpers/esm/typeof.js:1
(function (exports, require, module, __filename, __dirname) { import _Symbol$iterator from "../../core-js/symbol/iterator";
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._compile (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:104:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.&lt;anonymous&gt; (/home/metzger/projects/maketube/frontend/.next/server/static/development/pages/_error.js:7:39)
    at Module._compile (module.js:652:30)
    at Module._compile (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (/home/metzger/projects/maketube/frontend/node_modules/pirates/lib/index.js:104:7)

</code></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">This error should not occur</p>
<h2 dir="auto">System information</h2>
<p dir="auto">Here is my package.json:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;scripts&quot;: {
    &quot;dev&quot;: &quot;babel-node server.js --presets @babel/env&quot;,
    &quot;build&quot;: &quot;next build&quot;,
    &quot;start&quot;: &quot;NODE_ENV=production babel-node server.js --presets @babel/env&quot;
  },
  &quot;license&quot;: &quot;MIT&quot;,
  &quot;dependencies&quot;: {
    &quot;autoprefixer&quot;: &quot;7.1.5&quot;,
    &quot;aws-sdk&quot;: &quot;^2.213.1&quot;,
    &quot;axios&quot;: &quot;0.15.3&quot;,
    &quot;babel-plugin-wrap-in-js&quot;: &quot;^1.1.1&quot;,
    &quot;body-parser&quot;: &quot;^1.18.2&quot;,
    &quot;classnames&quot;: &quot;^2.2.5&quot;,
    &quot;cookie-parser&quot;: &quot;^1.4.3&quot;,
    &quot;express&quot;: &quot;^4.16.3&quot;,
    &quot;faker&quot;: &quot;^4.1.0&quot;,
    &quot;glob&quot;: &quot;^7.1.2&quot;,
    &quot;http-proxy-middleware&quot;: &quot;^0.17.4&quot;,
    &quot;jsonwebtoken&quot;: &quot;^8.2.0&quot;,
    &quot;jwt-decode&quot;: &quot;^2.2.0&quot;,
    &quot;lodash&quot;: &quot;^4.17.11&quot;,
    &quot;moment&quot;: &quot;^2.21.0&quot;,
    &quot;net&quot;: &quot;^1.0.2&quot;,
    &quot;next&quot;: &quot;latest&quot;,
    &quot;njwt&quot;: &quot;^0.4.0&quot;,
    &quot;node-sass&quot;: &quot;^4.4.0&quot;,
    &quot;normalize.css&quot;: &quot;^7.0.0&quot;,
    &quot;postcss-easy-import&quot;: &quot;^3.0.0&quot;,
    &quot;postcss-loader&quot;: &quot;^2.0.7&quot;,
    &quot;prop-types&quot;: &quot;^15.6.1&quot;,
    &quot;raw-loader&quot;: &quot;^0.5.1&quot;,
    &quot;react&quot;: &quot;^16.0.0&quot;,
    &quot;react-datepicker&quot;: &quot;^0.64.0&quot;,
    &quot;react-dom&quot;: &quot;^16.0.0&quot;,
    &quot;react-expand-collapse&quot;: &quot;^0.2.0&quot;,
    &quot;react-horizontal-timeline&quot;: &quot;^1.4.0&quot;,
    &quot;react-masonry-css&quot;: &quot;^1.0.12&quot;,
    &quot;react-particle-animation&quot;: &quot;^1.0.1&quot;,
    &quot;sass-loader&quot;: &quot;^6.0.6&quot;,
    &quot;semantic-ui-icon&quot;: &quot;^2.2.12&quot;,
    &quot;semantic-ui-react&quot;: &quot;^0.80.0&quot;,
    &quot;sqlite&quot;: &quot;^2.9.0&quot;,
    &quot;sqlite3&quot;: &quot;^3.1.13&quot;,
    &quot;superagent&quot;: &quot;^3.4.0&quot;,
    &quot;tls&quot;: &quot;0.0.1&quot;,
    &quot;universal-cookie&quot;: &quot;^2.1.2&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;@babel/cli&quot;: &quot;^7.2.3&quot;,
    &quot;@babel/core&quot;: &quot;^7.2.2&quot;,
    &quot;@babel/node&quot;: &quot;^7.2.2&quot;,
    &quot;@babel/preset-env&quot;: &quot;^7.2.3&quot;,
    &quot;babel-core&quot;: &quot;^7.0.0-bridge&quot;,
    &quot;babel-plugin-inline-react-svg&quot;: &quot;^0.4.0&quot;,
    &quot;babel-plugin-module-resolver&quot;: &quot;^3.1.1&quot;,
    &quot;now&quot;: &quot;^8.3.10&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "version": "1.0.0",
  "scripts": {
    "dev": "babel-node server.js --presets @babel/env",
    "build": "next build",
    "start": "NODE_ENV=production babel-node server.js --presets @babel/env"
  },
  "license": "MIT",
  "dependencies": {
    "autoprefixer": "7.1.5",
    "aws-sdk": "^2.213.1",
    "axios": "0.15.3",
    "babel-plugin-wrap-in-js": "^1.1.1",
    "body-parser": "^1.18.2",
    "classnames": "^2.2.5",
    "cookie-parser": "^1.4.3",
    "express": "^4.16.3",
    "faker": "^4.1.0",
    "glob": "^7.1.2",
    "http-proxy-middleware": "^0.17.4",
    "jsonwebtoken": "^8.2.0",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.11",
    "moment": "^2.21.0",
    "net": "^1.0.2",
    "next": "latest",
    "njwt": "^0.4.0",
    "node-sass": "^4.4.0",
    "normalize.css": "^7.0.0",
    "postcss-easy-import": "^3.0.0",
    "postcss-loader": "^2.0.7",
    "prop-types": "^15.6.1",
    "raw-loader": "^0.5.1",
    "react": "^16.0.0",
    "react-datepicker": "^0.64.0",
    "react-dom": "^16.0.0",
    "react-expand-collapse": "^0.2.0",
    "react-horizontal-timeline": "^1.4.0",
    "react-masonry-css": "^1.0.12",
    "react-particle-animation": "^1.0.1",
    "sass-loader": "^6.0.6",
    "semantic-ui-icon": "^2.2.12",
    "semantic-ui-react": "^0.80.0",
    "sqlite": "^2.9.0",
    "sqlite3": "^3.1.13",
    "superagent": "^3.4.0",
    "tls": "0.0.1",
    "universal-cookie": "^2.1.2"
  },
  "devDependencies": {
    "@babel/cli": "^7.2.3",
    "@babel/core": "^7.2.2",
    "@babel/node": "^7.2.2",
    "@babel/preset-env": "^7.2.3",
    "babel-core": "^7.0.0-bridge",
    "babel-plugin-inline-react-svg": "^0.4.0",
    "babel-plugin-module-resolver": "^3.1.1",
    "now": "^8.3.10"
  }
}
</code></pre></div>
<p dir="auto">I am getting the following issue which I presume is related to babel.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="node_modules/@babel/runtime-corejs2/helpers/esm/asyncToGenerator.js:1
(function (exports, require, module, __filename, __dirname) { import _Promise from &quot;../../core-js/promise&quot;;

SyntaxError: Unexpected token import"><pre class="notranslate"><code class="notranslate">node_modules/@babel/runtime-corejs2/helpers/esm/asyncToGenerator.js:1
(function (exports, require, module, __filename, __dirname) { import _Promise from "../../core-js/promise";

SyntaxError: Unexpected token import
</code></pre></div>
<p dir="auto">It seems that <code class="notranslate">@babel/runtime-corejs2/helpers/esm</code> is being used instead of just<code class="notranslate">@babel/runtime-corejs2/helpers</code> where the compiled files seem to be.</p>
<p dir="auto">I didn't notice this in <code class="notranslate">dev</code> with the following config</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;presets&quot;: [
   [&quot;next/babel&quot;, {&quot;preset-env&quot;: {
      &quot;modules&quot;: &quot;commonjs&quot;
    }}]
 ],"><pre class="notranslate"><code class="notranslate">"presets": [
   ["next/babel", {"preset-env": {
      "modules": "commonjs"
    }}]
 ],
</code></pre></div>
<p dir="auto">The issue is when I try and run the production build. Here is the relevant config</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;env&quot;: {
    &quot;production&quot;: {
      &quot;presets&quot;: [
        [&quot;next/babel&quot;, {
          &quot;preset-env&quot;: {
            &quot;targets&quot;: {
              &quot;browsers&quot;: [&quot;&gt; 1%&quot;]
            }
          }
        }]
      ],
      &quot;plugins&quot;: [
        [ &quot;babel-plugin-styled-components&quot;, { &quot;displayName&quot;: false } ],
        &quot;transform-react-constant-elements&quot;,
        &quot;@babel/plugin-transform-react-inline-elements&quot;
      ]
    },
  },
  &quot;plugins&quot;: [
    [
      &quot;transform-imports&quot;,
      {
        &quot;lodash&quot;: {
          &quot;transform&quot;: &quot;lodash/${member}&quot;,
          &quot;preventFullImport&quot;: true
        },
        &quot;validator&quot;: {
          &quot;transform&quot;: &quot;validator/lib/${member}&quot;,
          &quot;preventFullImport&quot;: true
        },
        &quot;recompose&quot;: {
          &quot;transform&quot;: &quot;recompose/${member}&quot;,
          &quot;preventFullImport&quot;: true
        },
      }
    ], 
    &quot;date-fns&quot;,
    &quot;transform-modern-regexp&quot;,
    &quot;@babel/plugin-proposal-export-default-from&quot;,
    &quot;@babel/plugin-proposal-export-namespace-from&quot;,
    &quot;@babel/plugin-proposal-optional-catch-binding&quot;,
    [ 
      &quot;module-resolver&quot;, { 
        &quot;root&quot;: [ &quot;./src&quot; ]
      } 
    ],
    [
      &quot;inline-import&quot;, {
        &quot;extensions&quot;: [ &quot;.css&quot; ]
      }
    ]
  ]
}
"><pre class="notranslate"><code class="notranslate">{
  "env": {
    "production": {
      "presets": [
        ["next/babel", {
          "preset-env": {
            "targets": {
              "browsers": ["&gt; 1%"]
            }
          }
        }]
      ],
      "plugins": [
        [ "babel-plugin-styled-components", { "displayName": false } ],
        "transform-react-constant-elements",
        "@babel/plugin-transform-react-inline-elements"
      ]
    },
  },
  "plugins": [
    [
      "transform-imports",
      {
        "lodash": {
          "transform": "lodash/${member}",
          "preventFullImport": true
        },
        "validator": {
          "transform": "validator/lib/${member}",
          "preventFullImport": true
        },
        "recompose": {
          "transform": "recompose/${member}",
          "preventFullImport": true
        },
      }
    ], 
    "date-fns",
    "transform-modern-regexp",
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-optional-catch-binding",
    [ 
      "module-resolver", { 
        "root": [ "./src" ]
      } 
    ],
    [
      "inline-import", {
        "extensions": [ ".css" ]
      }
    ]
  ]
}

</code></pre></div>