mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
feat(module): easier options
Allow using babel style array and flatten options
This commit is contained in:
parent
79b97093d0
commit
44c6a25247
@ -95,8 +95,15 @@ class Module {
|
|||||||
if (!moduleOpts) {
|
if (!moduleOpts) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Allow using babel style array options
|
||||||
|
if(Array.isArray(moduleOpts)) {
|
||||||
|
moduleOpts = {
|
||||||
|
src: moduleOpts[0],
|
||||||
|
options: moduleOpts[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
// Allows passing runtime options to each module
|
// Allows passing runtime options to each module
|
||||||
const options = moduleOpts.options || {}
|
const options = moduleOpts.options || (typeof moduleOpts === 'object' ? moduleOpts : {})
|
||||||
const originalSrc = moduleOpts.src || moduleOpts
|
const originalSrc = moduleOpts.src || moduleOpts
|
||||||
// Resolve module
|
// Resolve module
|
||||||
let module = originalSrc
|
let module = originalSrc
|
||||||
|
Loading…
Reference in New Issue
Block a user