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/document': require.resolve('../../../server/document'),
|
||||
'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',
|
||||
include: nextPagesDir,
|
||||
exclude (str) {
|
||||
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
||||
},
|
||||
options: {
|
||||
babelrc: false,
|
||||
cacheDirectory: true,
|
||||
sourceMaps: dev ? 'both' : false,
|
||||
plugins: [
|
||||
[
|
||||
require.resolve('babel-plugin-module-resolver'),
|
||||
{
|
||||
alias: {
|
||||
'ansi-html': require.resolve('ansi-html'),
|
||||
'styled-jsx/style': require.resolve('styled-jsx/style')
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
presets: [require.resolve('./babel/preset')]
|
||||
}
|
||||
}, {
|
||||
test: /\.js(\?[^?]*)?$/,
|
||||
loader: 'babel-loader',
|
||||
include: [dir, nextPagesDir],
|
||||
include: [dir],
|
||||
exclude (str) {
|
||||
return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
|
||||
return /node_modules/.test(str)
|
||||
},
|
||||
query: mainBabelOptions
|
||||
options: mainBabelOptions
|
||||
}])
|
||||
|
||||
let webpackConfig = {
|
||||
|
|
Loading…
Reference in a new issue