mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Remove default next pages compilation from the main babel-loader. (#731)
* Remove default next pages compilation from the main babel-loader. This will fix the issue when the user ignore node_modules via our .babelrc option. * Change babel-loaders 'query' to 'options'. That's what's supported/recommended in webpack 2
This commit is contained in:
parent
b7e57f9347
commit
8811a334f4
|
@ -27,7 +27,8 @@ module.exports = {
|
||||||
'next/head': require.resolve('../../../lib/head'),
|
'next/head': require.resolve('../../../lib/head'),
|
||||||
'next/document': require.resolve('../../../server/document'),
|
'next/document': require.resolve('../../../server/document'),
|
||||||
'next/router': require.resolve('../../../lib/router'),
|
'next/router': require.resolve('../../../lib/router'),
|
||||||
'styled-jsx/style': require.resolve('styled-jsx/style')
|
'styled-jsx/style': require.resolve('styled-jsx/style'),
|
||||||
|
'ansi-html': require.resolve('ansi-html')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -143,30 +143,23 @@ export default async function createCompiler (dir, { dev = false, quiet = false
|
||||||
}, {
|
}, {
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
include: nextPagesDir,
|
include: nextPagesDir,
|
||||||
|
exclude (str) {
|
||||||
|
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
cacheDirectory: true,
|
cacheDirectory: true,
|
||||||
sourceMaps: dev ? 'both' : false,
|
sourceMaps: dev ? 'both' : false,
|
||||||
plugins: [
|
presets: [require.resolve('./babel/preset')]
|
||||||
[
|
|
||||||
require.resolve('babel-plugin-module-resolver'),
|
|
||||||
{
|
|
||||||
alias: {
|
|
||||||
'ansi-html': require.resolve('ansi-html'),
|
|
||||||
'styled-jsx/style': require.resolve('styled-jsx/style')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
test: /\.js(\?[^?]*)?$/,
|
test: /\.js(\?[^?]*)?$/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
include: [dir, nextPagesDir],
|
include: [dir],
|
||||||
exclude (str) {
|
exclude (str) {
|
||||||
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
return /node_modules/.test(str)
|
||||||
},
|
},
|
||||||
query: mainBabelOptions
|
options: mainBabelOptions
|
||||||
}])
|
}])
|
||||||
|
|
||||||
let webpackConfig = {
|
let webpackConfig = {
|
||||||
|
|
Loading…
Reference in a new issue