forked from nuxt/nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuxt.js
More file actions
46 lines (37 loc) · 1.2 KB
/
nuxt.js
File metadata and controls
46 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import path from 'path'
import { defaultsDeep } from 'lodash'
import { version as coreVersion } from '../../packages/core/package.json'
export { Nuxt } from '../../packages/core/src/index'
export { Builder } from '../../packages/builder/src/index'
export { Generator } from '../../packages/generator/src/index'
export { BundleBuilder } from '../../packages/webpack/src/index'
export * from '../../packages/utils/src/index'
export const version = `v${coreVersion}`
export const loadFixture = async function (fixture, overrides) {
const rootDir = path.resolve(__dirname, '..', 'fixtures', fixture)
let config = {}
try {
config = await import(`../fixtures/${fixture}/nuxt.config`)
config = config.default || config
} catch (e) {
// Ignore MODULE_NOT_FOUND
if (e.code !== 'MODULE_NOT_FOUND') {
throw e
}
}
if (typeof config === 'function') {
config = await config()
}
config.rootDir = rootDir
config.dev = false
config.test = true
// disable terser to speed-up fixture builds
if (config.build) {
if (!config.build.terser) {
config.build.terser = false
}
} else {
config.build = { terser: false }
}
return defaultsDeep({}, overrides, config)
}