mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: replace nuxtDir with module.paths (#4448)
Co-authored-by: Pooya Parsa <pooya@pi0.ir> Co-authored-by: Clark Du <clark.duxin@gmail.com>
This commit is contained in:
parent
2f1e0045cc
commit
d66e1ec896
@ -1,5 +1,3 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import capitalize from 'lodash/capitalize'
|
||||
import env from 'std-env'
|
||||
|
||||
@ -31,9 +29,6 @@ export default () => ({
|
||||
// Dirs and extensions
|
||||
srcDir: undefined,
|
||||
buildDir: '.nuxt',
|
||||
nuxtDir: fs.existsSync(path.resolve(__dirname, '..', '..', 'package.js'))
|
||||
? path.resolve(__dirname, '..', '..') // src
|
||||
: path.resolve(__dirname, '..'), // dist
|
||||
modulesDir: [
|
||||
'node_modules'
|
||||
],
|
||||
|
@ -4,6 +4,7 @@ import defaultsDeep from 'lodash/defaultsDeep'
|
||||
import defaults from 'lodash/defaults'
|
||||
import pick from 'lodash/pick'
|
||||
import isObject from 'lodash/isObject'
|
||||
import uniq from 'lodash/uniq'
|
||||
import consola from 'consola'
|
||||
import { guardDir, isNonEmptyString, isPureObject, isUrl } from '@nuxt/common'
|
||||
import { getDefaultNuxtConfig } from './config'
|
||||
@ -97,10 +98,11 @@ export function getNuxtConfig(_options) {
|
||||
}
|
||||
|
||||
// Populate modulesDir
|
||||
options.modulesDir = []
|
||||
.concat(options.modulesDir)
|
||||
.concat(path.join(options.nuxtDir, 'node_modules')).filter(isNonEmptyString)
|
||||
.map(dir => path.resolve(options.rootDir, dir))
|
||||
options.modulesDir = uniq(
|
||||
require.main.paths.concat(
|
||||
[].concat(options.modulesDir).map(dir => path.resolve(options.rootDir, dir))
|
||||
)
|
||||
)
|
||||
|
||||
const mandatoryExtensions = ['js', 'mjs']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user