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:
parent
165924b71b
commit
3dae510d51
|
@ -48,7 +48,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
|
||||||
interpolateNames.set(path, `dist/pages/${p}`)
|
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 minChunks = pages.filter((p) => p !== documentPage).length
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
@ -186,8 +187,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
modules: [
|
modules: [
|
||||||
nodeModulesDir,
|
nextNodeModulesDir,
|
||||||
join(dir, 'node_modules')
|
appNodeModulesDir
|
||||||
].concat(
|
].concat(
|
||||||
(process.env.NODE_PATH || '')
|
(process.env.NODE_PATH || '')
|
||||||
.split(process.platform === 'win32' ? ';' : ':')
|
.split(process.platform === 'win32' ? ';' : ':')
|
||||||
|
@ -196,7 +197,8 @@ export default async function createCompiler (dir, { dev = false, quiet = false
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
modules: [
|
modules: [
|
||||||
nodeModulesDir,
|
nextNodeModulesDir,
|
||||||
|
appNodeModulesDir,
|
||||||
join(__dirname, 'loaders')
|
join(__dirname, 'loaders')
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue