fix(nuxt-dev): ensure cache is cleaned for nuxt.config.js

This commit is contained in:
Pooya Parsa 2018-04-22 12:01:35 +04:30
parent 85cfc625ee
commit 050e380203

View File

@ -2,7 +2,12 @@
const { resolve } = require('path')
const { existsSync } = require('fs')
const consola = require('consola')
const esm = require('esm')(module, {})
const esm = require('esm')(module, {
cache: false,
cjs: {
cache: true
}
})
const getRootDir = argv => resolve(argv._[0] || '.')
const getNuxtConfigFile = argv => resolve(getRootDir(argv), argv['config-file'])
@ -16,6 +21,7 @@ exports.loadNuxtConfig = argv => {
let options = {}
if (existsSync(nuxtConfigFile)) {
delete require.cache[nuxtConfigFile]
options = esm(nuxtConfigFile)
if (!options) {
options = {}