refactor(config): alias export to generate (#7399)

* refactor: alias option.export to options.generate

* chore: keep same references
This commit is contained in:
Pooya Parsa 2020-05-20 17:43:25 +02:00 committed by GitHub
parent e9a4ca6ac2
commit 0bdc71c8d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -114,6 +114,13 @@ export function getNuxtConfig (_options) {
options.router.base += '/'
}
// Alias export to generate
// TODO: switch to export by default for nuxt3
if (options.export) {
options.generate = defu(options.export, options.generate)
}
exports.export = options.generate
// Check srcDir and generate.dir existence
const hasSrcDir = isNonEmptyString(options.srcDir)
const hasGenerateDir = isNonEmptyString(options.generate.dir)

View File

@ -162,6 +162,11 @@ describe('config: options', () => {
expect(fallback).toEqual('fallback.html')
})
test('export should alias to generate', () => {
const { generate: { fallback } } = getNuxtConfig({ export: { fallback: 'fallback.html' } })
expect(fallback).toEqual('fallback.html')
})
test('should disable parallel if extractCSS is enabled', () => {
const { build: { parallel } } = getNuxtConfig({ build: { extractCSS: true, parallel: true } })
expect(parallel).toEqual(false)