misc: fix typos

This commit is contained in:
Clark Du 2018-07-18 15:39:48 +01:00
parent c3e51a05af
commit e2296061b0
No known key found for this signature in database
GPG Key ID: 32CBD8CD478AF898
3 changed files with 9 additions and 7 deletions

View File

@ -258,12 +258,12 @@ export const createRoutes = function createRoutes(files, srcDir, pagesDir) {
let parent = routes let parent = routes
keys.forEach((key, i) => { keys.forEach((key, i) => {
// remove underscore only, if its the prefix // remove underscore only, if its the prefix
const sanatizedKey = key.indexOf('_') === 0 const sanitizedKey = key.indexOf('_') === 0
? key.replace('_', '') ? key.replace('_', '')
: key : key
route.name = route.name route.name = route.name
? route.name + '-' + sanatizedKey ? route.name + '-' + sanitizedKey
: sanatizedKey : sanitizedKey
route.name += key === '_' ? 'all' : '' route.name += key === '_' ? 'all' : ''
route.chunkName = file.replace(/\.(vue|js)$/, '') route.chunkName = file.replace(/\.(vue|js)$/, '')
let child = _.find(parent, { name: route.name }) let child = _.find(parent, { name: route.name })

View File

@ -22,7 +22,7 @@ export default class ModuleContainer {
} }
addVendor(vendor) { addVendor(vendor) {
// Make it silent for backward compability with nuxt 1.x // Make it silent for backward compatibility with nuxt 1.x
} }
addTemplate(template) { addTemplate(template) {
@ -112,7 +112,9 @@ export default class ModuleContainer {
// Resolve handler // Resolve handler
if (!handler) { if (!handler) {
handler = this.nuxt.requireModule(src, { esm: false }) // If module is internal (src starts with '.' or alias '@' '~'), support esm
const isInnerModule = /^[.@~]/.test(src)
handler = this.nuxt.requireModule(src, { esm: isInnerModule })
} }
// Validate handler // Validate handler

View File

@ -199,8 +199,8 @@ export default class Nuxt {
} }
requireModule(_path, opts = {}) { requireModule(_path, opts = {}) {
const _resovledPath = this.resolvePath(_path) const _resolvedPath = this.resolvePath(_path)
const m = opts.esm === false ? require(_resovledPath) : this.esm(_resovledPath) const m = opts.esm === false ? require(_resolvedPath) : this.esm(_resolvedPath)
return (m && m.default) || m return (m && m.default) || m
} }