mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
fix(resolvePath): using require.resolve first to support scopped module
This commit is contained in:
parent
29a7874169
commit
57e75c58d2
@ -94,6 +94,15 @@ export default class Nuxt extends Tapable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resolvePath (path) {
|
resolvePath (path) {
|
||||||
|
// Try to resolve using NPM resolve path first
|
||||||
|
// Fixes problems with scopped modules
|
||||||
|
try {
|
||||||
|
let resolvedPath = require.resolve(path)
|
||||||
|
return resolvedPath
|
||||||
|
} catch (e) {
|
||||||
|
// Just continue
|
||||||
|
}
|
||||||
|
|
||||||
// Shorthand to resolve from project srcDir
|
// Shorthand to resolve from project srcDir
|
||||||
if (path.indexOf('@') === 0 || path.indexOf('~') === 0) {
|
if (path.indexOf('@') === 0 || path.indexOf('~') === 0) {
|
||||||
if (path.indexOf('~') === 0) {
|
if (path.indexOf('~') === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user