mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +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) {
|
||||
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
|
||||
const options = moduleOpts.options || {}
|
||||
const options = moduleOpts.options || (typeof moduleOpts === 'object' ? moduleOpts : {})
|
||||
const originalSrc = moduleOpts.src || moduleOpts
|
||||
// Resolve module
|
||||
let module = originalSrc
|
||||
|
Loading…
Reference in New Issue
Block a user