diff --git a/packages/builder/src/builder.js b/packages/builder/src/builder.js index dfc55b5030..155ab4871d 100644 --- a/packages/builder/src/builder.js +++ b/packages/builder/src/builder.js @@ -198,7 +198,7 @@ export default class Builder { validateTemplate() { // Validate template dependencies const templateDependencies = this.template.dependencies - const dpendencyFixes = [] + const dependencyFixes = [] for (const depName in templateDependencies) { const depVersion = templateDependencies[depName] const requiredVersion = `${depName}@${depVersion}` @@ -209,24 +209,24 @@ export default class Builder { const validVersion = semver.satisfies(pkg.version, depVersion) if (!validVersion) { consola.warn(`${requiredVersion} is required but ${depName}@${pkg.version} is installed!`) - dpendencyFixes.push(requiredVersion) + dependencyFixes.push(requiredVersion) } } else { consola.warn(`${depName}@${depVersion} is required but not installed!`) - dpendencyFixes.push(requiredVersion) + dependencyFixes.push(requiredVersion) } } // Suggest dependency fixes (TODO: automate me) - if (dpendencyFixes.length) { + if (dependencyFixes.length) { consola.error( 'Please install missing dependencies:\n', '\n', 'Using yarn:\n', - `yarn add ${dpendencyFixes.join(' ')}\n`, + `yarn add ${dependencyFixes.join(' ')}\n`, '\n', 'Using npm:\n', - `npm i ${dpendencyFixes.join(' ')}\n` + `npm i ${dependencyFixes.join(' ')}\n` ) throw new Error('Missing Template Dependencies') } diff --git a/packages/core/src/resolver.js b/packages/core/src/resolver.js index 684e543df9..7fa3a731ac 100644 --- a/packages/core/src/resolver.js +++ b/packages/core/src/resolver.js @@ -111,11 +111,14 @@ export default class Resolver { throw new Error(`Cannot resolve "${path}" from "${resolvedPath}"`) } - requireModule(path, { esm, useESM = esm, alias, isAlias = alias, intropDefault } = {}) { + requireModule(path, { esm, useESM = esm, alias, isAlias = alias, intropDefault, interopDefault = intropDefault } = {}) { let resolvedPath = path let requiredModule // TODO: Remove in Nuxt 3 + if (intropDefault) { + consola.warn('Using intropDefault is deprecated and will be removed in Nuxt 3. Use `interopDefault` instead.') + } if (alias) { consola.warn('Using alias is deprecated and will be removed in Nuxt 3. Use `isAlias` instead.') } @@ -148,8 +151,8 @@ export default class Resolver { lastError = e } - // Introp default - if (intropDefault !== false && requiredModule && requiredModule.default) { + // Interop default + if (interopDefault !== false && requiredModule && requiredModule.default) { requiredModule = requiredModule.default } diff --git a/packages/core/test/resolver.test.js b/packages/core/test/resolver.test.js index 44f1c5c0a8..21af631add 100644 --- a/packages/core/test/resolver.test.js +++ b/packages/core/test/resolver.test.js @@ -384,14 +384,14 @@ describe('core: resolver', () => { expect(resolvedModule).toEqual('resolved module') }) - test('should require es modules without default export when intropDefault is disabled', () => { + test('should require es modules without default export when interopDefault is disabled', () => { const resolver = new Resolver({ options: {} }) resolver.resolvePath = jest.fn() resolver.esm = jest.fn(() => ({ default: 'resolved module' })) - const resolvedModule = resolver.requireModule('/var/nuxt/resolver/module', { intropDefault: false }) + const resolvedModule = resolver.requireModule('/var/nuxt/resolver/module', { interopDefault: false }) expect(resolvedModule).toEqual({ default: 'resolved module' }) })