1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Add app's node_modules dir to resolveLoaders. (#583)

Otherwise, webpack will throw an error saying
it couldn't find entries.
That's because it couldn't find babel-loader and
other loaders installed into app's node_modules dir.
This commit is contained in:
Arunoda Susiripala 2016-12-31 18:47:52 +05:30 committed by Naoyuki Kanezawa
parent 165924b71b
commit 3dae510d51

View file

@ -48,7 +48,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
interpolateNames.set(path, `dist/pages/${p}`)
}
const nodeModulesDir = join(__dirname, '..', '..', '..', 'node_modules')
const nextNodeModulesDir = join(__dirname, '..', '..', '..', 'node_modules')
const appNodeModulesDir = join(dir, 'node_modules')
const minChunks = pages.filter((p) => p !== documentPage).length
const plugins = [
@ -186,8 +187,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
},
resolve: {
modules: [
nodeModulesDir,
join(dir, 'node_modules')
nextNodeModulesDir,
appNodeModulesDir
].concat(
(process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':')
@ -196,7 +197,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
},
resolveLoader: {
modules: [
nodeModulesDir,
nextNodeModulesDir,
appNodeModulesDir,
join(__dirname, 'loaders')
]
},