Issue 1:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

My app should be deployed to now.sh using a custom webpack config and a custom .babelrc

Current Behavior

Deploy fails in next build stage.

> Using external babel configuration
07/12 10:59 AM (33m)
> location: "/home/nowuser/src/.babelrc"
07/12 10:59 AM (33m)
> Using "webpack" config function defined in next.config.js.
07/12 10:59 AM (32m)
> Failed to build on /tmp/917ccbd0-55db-4437-a2c0-544b2502d880
07/12 10:59 AM (32m)
{ Error: ./pages/_document.js?entry
Module build failed: SyntaxError: Unexpected token (24:6)

22 | render() {
23 | return (
> 24 | <html lang="en-US">
| ^
25 | <Head>
26 | <meta
27 | name="viewport"

Error
at transpile (/home/nowuser/src/node_modules/babel-loader/lib/index.js:64:13)
at /home/nowuser/src/node_modules/babel-loader/lib/fs-cache.js:118:18
at ReadFileContext.callback (/home/nowuser/src/node_modules/babel-loader/lib/fs-cache.js:31:21)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:419:13)
@ multi ./pages/_document.js?entry
at /home/nowuser/src/node_modules/next/dist/server/build/index.js:182:21
at /home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:274:15
at Compiler.emitRecords (/home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:369:37)
at /home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:267:12
at /home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:362:11
at next (/home/nowuser/src/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/home/nowuser/src/node_modules/next/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/nowuser/src/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:359:8)
at Compiler.<anonymous> (/home/nowuser/src/node_modules/next/node_modules/webpack/lib/Compiler.js:354:14)

Steps to Reproduce (for bugs)

run now

Context

next.config.js

const path = require('path')
const glob = require('glob')

module.exports = {
webpack: (config, { dev }) => {
config.module.rules.push(
{
test: /\.(css|graphql|gql|scss|sass)/,
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]',
},
}
,
{
test: /\.css$/,
use: ['babel-loader', 'raw-loader', 'postcss-loader'],
},
{
test: /\.s(a|c)ss$/,
use: ['babel-loader', 'raw-loader', 'postcss-loader',
{
loader: 'sass-loader',
options: {
includePaths: ['styles', 'node_modules']
.map((d) => path.join(__dirname, d))
.map((g) => glob.sync(g))
.reduce((a, c) => a.concat(c), [])
}
}
]
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
}
)
return config
}
}

.babelrc

{
"env": {
"development": {
"presets": "./babel-preset"
},
"production": {
"presets": "./babel-preset"
},
"test": {
"presets": [
["env", { "modules": "commonjs" }],
"./babel-preset"
]
}
}
}

babel-preset.js

const nextBabelPreset = require('next/babel');

nextBabelPreset.plugins = nextBabelPreset.plugins.map(plugin => {
if (!Array.isArray(plugin) && plugin.indexOf('styled-jsx/babel') !== -1) {
return require.resolve('styled-jsx-postcss/babel');
}
return plugin
});

module.exports = nextBabelPreset;

Your Environment

Tech
Version

next
3

node
8

OS
Mac

browser

etc

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Steps at https://learnnextjs.com/basics/getting-started/setup should succeed compilation and show 404 in the browser.

Current Behavior

ERROR Failed to compile with 1 errors

15:19:19

This module was not found:

react-dom/lib/ReactReconciler in ./node_modules/next/dist/client/next-dev.js

To install it, you can run: npm install --save react-dom/lib/ReactReconciler

(node:78867) DeprecationWarning: Module.chunks: Use Module.forEachChunk/mapChunks/getNumberOfChunks/isInChunk/addChunk/removeChunk instead

Ready on http://localhost:3000

Steps to Reproduce

Steps are at https://learnnextjs.com/basics/getting-started/setup

Context

This is my initial discovery of nextjs and my first exploration of the learning resources.

Your Environment

Tech
Version

next
3.2.2

node
8.1.2

OS
macOS 10.12.6

browser
Chrome 61

nvm
0.32.1