Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default next pages compilation from the main babel-loader. #731

Merged
merged 2 commits into from
Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/build/babel/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkzawa I tried adding module-resolver plugin to the nextPagesDir's babel-loader. But it seems like we can use only one module-resolver instance at a once.

So, it'll discard all of these if I add a module-resolver there. That's why I added ansi-html to this list.

Copy link
Contributor

@nkzawa nkzawa Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

This is not required anymore by #741 anyway

}
}
]
Expand Down
21 changes: 7 additions & 14 deletions server/build/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down