mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-20 15:41:11 +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 capitalize from 'lodash/capitalize'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
|
|
||||||
@ -31,9 +29,6 @@ export default () => ({
|
|||||||
// Dirs and extensions
|
// Dirs and extensions
|
||||||
srcDir: undefined,
|
srcDir: undefined,
|
||||||
buildDir: '.nuxt',
|
buildDir: '.nuxt',
|
||||||
nuxtDir: fs.existsSync(path.resolve(__dirname, '..', '..', 'package.js'))
|
|
||||||
? path.resolve(__dirname, '..', '..') // src
|
|
||||||
: path.resolve(__dirname, '..'), // dist
|
|
||||||
modulesDir: [
|
modulesDir: [
|
||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
|
@ -4,6 +4,7 @@ import defaultsDeep from 'lodash/defaultsDeep'
|
|||||||
import defaults from 'lodash/defaults'
|
import defaults from 'lodash/defaults'
|
||||||
import pick from 'lodash/pick'
|
import pick from 'lodash/pick'
|
||||||
import isObject from 'lodash/isObject'
|
import isObject from 'lodash/isObject'
|
||||||
|
import uniq from 'lodash/uniq'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { guardDir, isNonEmptyString, isPureObject, isUrl } from '@nuxt/common'
|
import { guardDir, isNonEmptyString, isPureObject, isUrl } from '@nuxt/common'
|
||||||
import { getDefaultNuxtConfig } from './config'
|
import { getDefaultNuxtConfig } from './config'
|
||||||
@ -97,10 +98,11 @@ export function getNuxtConfig(_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Populate modulesDir
|
// Populate modulesDir
|
||||||
options.modulesDir = []
|
options.modulesDir = uniq(
|
||||||
.concat(options.modulesDir)
|
require.main.paths.concat(
|
||||||
.concat(path.join(options.nuxtDir, 'node_modules')).filter(isNonEmptyString)
|
[].concat(options.modulesDir).map(dir => path.resolve(options.rootDir, dir))
|
||||||
.map(dir => path.resolve(options.rootDir, dir))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
const mandatoryExtensions = ['js', 'mjs']
|
const mandatoryExtensions = ['js', 'mjs']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user