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

Add NODE_PATH support (#3656)

This commit is contained in:
Tim Neutkens 2018-02-01 16:21:18 +01:00 committed by GitHub
parent 7e00548b8a
commit b38c05bc95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 totalPages
let webpackConfig = { let webpackConfig = {
@ -132,7 +137,8 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
extensions: ['.js', '.jsx', '.json'], extensions: ['.js', '.jsx', '.json'],
modules: [ modules: [
nextNodeModulesDir, nextNodeModulesDir,
'node_modules' 'node_modules',
...nodePathList // Support for NODE_PATH environment variable
], ],
alias: { alias: {
next: nextDir, next: nextDir,
@ -146,7 +152,8 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
modules: [ modules: [
nextNodeModulesDir, nextNodeModulesDir,
'node_modules', 'node_modules',
path.join(__dirname, 'loaders') path.join(__dirname, 'loaders'),
...nodePathList // Support for NODE_PATH environment variable
] ]
}, },
module: { module: {