From 57e75c58d28b1e50c2b58b6cadb97fc60eab706b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 30 Jun 2017 15:49:22 +0430 Subject: [PATCH] fix(resolvePath): using require.resolve first to support scopped module --- lib/core/nuxt.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/core/nuxt.js b/lib/core/nuxt.js index b0b9d08bde..bc7d8c524c 100644 --- a/lib/core/nuxt.js +++ b/lib/core/nuxt.js @@ -94,6 +94,15 @@ export default class Nuxt extends Tapable { } 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 if (path.indexOf('@') === 0 || path.indexOf('~') === 0) { if (path.indexOf('~') === 0) {