From 3dae510d5162616efb573e761749dec5123c4da1 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Sat, 31 Dec 2016 18:47:52 +0530 Subject: [PATCH] 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. --- server/build/webpack.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/build/webpack.js b/server/build/webpack.js index 6ced112c..80dca3e1 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -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') ] },