Fix resolve when using alias

This commit is contained in:
Sébastien Chopin 2016-11-16 18:06:54 +01:00
parent b1546682ef
commit d2c0f01593
2 changed files with 9 additions and 6 deletions

View File

@ -15,7 +15,13 @@ const remove = pify(fs.remove)
const readFile = pify(fs.readFile) const readFile = pify(fs.readFile)
const writeFile = pify(fs.writeFile) const writeFile = pify(fs.writeFile)
const mkdirp = pify(fs.mkdirp) 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 = { const defaults = {
filenames: { filenames: {
@ -100,10 +106,7 @@ module.exports = function * () {
if (route.component.slice(-4) !== '.vue') { if (route.component.slice(-4) !== '.vue') {
route.component = route.component + '.vue' route.component = route.component + '.vue'
} }
// If not using an alias route.component = r(this.dir, route.component)
if (route.component.indexOf('~') === -1) {
route.component = r(this.dir, route.component)
}
}) })
// Generate routes and interpret the template files // Generate routes and interpret the template files
yield generateRoutesAndFiles.call(this) yield generateRoutesAndFiles.call(this)

View File

@ -1,6 +1,6 @@
{ {
"name": "nuxt", "name": "nuxt",
"version": "0.4.1", "version": "0.4.2",
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)", "description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",