From d2c0f01593e669147396ff25c4a017372a8390ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 16 Nov 2016 18:06:54 +0100 Subject: [PATCH] Fix resolve when using alias --- lib/build/index.js | 13 ++++++++----- package.json | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/build/index.js b/lib/build/index.js index e8bd9d369d..af149438dc 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -15,7 +15,13 @@ const remove = pify(fs.remove) const readFile = pify(fs.readFile) const writeFile = pify(fs.writeFile) const mkdirp = pify(fs.mkdirp) -const r = resolve +const r = function () { + const args = Array.from(arguments) + if (_.last(args).includes('~')) { + return _.last(args) + } + return resolve.apply(null, arguments) +} const defaults = { filenames: { @@ -100,10 +106,7 @@ module.exports = function * () { if (route.component.slice(-4) !== '.vue') { route.component = route.component + '.vue' } - // If not using an alias - if (route.component.indexOf('~') === -1) { - route.component = r(this.dir, route.component) - } + route.component = r(this.dir, route.component) }) // Generate routes and interpret the template files yield generateRoutesAndFiles.call(this) diff --git a/package.json b/package.json index dcc9fecf01..3703a3623f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt", - "version": "0.4.1", + "version": "0.4.2", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "main": "index.js", "license": "MIT",