Issue 1:
Bug report

Describe the bug

When I run npm install it runs through fine, then i start my app using npm run dev and browse to a page and that is when I see the error message.

/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.<anonymous> (/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)

Expected behavior

This error should not occur

System information

Here is my package.json:

{
"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"
}
}

Issue 2:
I am getting the following issue which I presume is related to babel.

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

It seems that @babel/runtime-corejs2/helpers/esm is being used instead of just@babel/runtime-corejs2/helpers where the compiled files seem to be.

I didn't notice this in dev with the following config

"presets": [
["next/babel", {"preset-env": {
"modules": "commonjs"
}}]
],

The issue is when I try and run the production build. Here is the relevant config

{
"env": {
"production": {
"presets": [
["next/babel", {
"preset-env": {
"targets": {
"browsers": ["> 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" ]
}
]
]
}