fix(resolvePath): using require.resolve first to support scopped module

This commit is contained in:
Pooya Parsa 2017-06-30 15:49:22 +04:30
parent 29a7874169
commit 57e75c58d2

View File

@ -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) {