From b38c05bc95a4443c1947e5cfe42d7af004259ab6 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 1 Feb 2018 16:21:18 +0100 Subject: [PATCH] Add NODE_PATH support (#3656) --- server/build/webpack.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/build/webpack.js b/server/build/webpack.js index 4489afdd..a6d5fdce 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -92,6 +92,11 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer } } + // Support for NODE_PATH + const nodePathList = (process.env.NODE_PATH || '') + .split(process.platform === 'win32' ? ';' : ':') + .filter((p) => !!p) + let totalPages let webpackConfig = { @@ -132,7 +137,8 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer extensions: ['.js', '.jsx', '.json'], modules: [ nextNodeModulesDir, - 'node_modules' + 'node_modules', + ...nodePathList // Support for NODE_PATH environment variable ], alias: { next: nextDir, @@ -146,7 +152,8 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer modules: [ nextNodeModulesDir, 'node_modules', - path.join(__dirname, 'loaders') + path.join(__dirname, 'loaders'), + ...nodePathList // Support for NODE_PATH environment variable ] }, module: {