internals: improve options module (#1392)

This commit is contained in:
Hana Shiro 2017-08-16 15:40:10 +08:00 committed by Pooya Parsa
parent 9db110002a
commit db19b50a02
2 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,11 @@ import { join, resolve } from 'path'
import { existsSync } from 'fs'
import { isUrl, isPureObject } from 'utils'
export default function Options (_options) {
const Options = {}
export default Options
Options.from = function (_options) {
// Clone options to prevent unwanted side-effects
const options = Object.assign({}, _options)

View File

@ -15,7 +15,7 @@ export default class Nuxt extends Tapable {
constructor (_options = {}) {
super()
this.options = Options(_options)
this.options = Options.from(_options)
// Paths for resolving requires from `rootDir`
this.nodeModulePaths = Module._nodeModulePaths(this.options.rootDir)