refactor: rename loader to load as not to confuse webpack loader

This commit is contained in:
endiliey 2018-08-07 00:41:05 +08:00
parent 36eee2941a
commit 9fef99cb18
15 changed files with 4 additions and 131 deletions

14
lib/load/config.js Normal file
View file

@ -0,0 +1,14 @@
const fs = require('fs-extra');
const path = require('path');
module.exports = function loadConfig(siteDir, deleteCache = true) {
const configPath = path.resolve(siteDir, 'siteConfig.js');
if (deleteCache) {
delete require.cache[configPath];
}
let config = {};
if (fs.existsSync(configPath)) {
config = require(configPath); // eslint-disable-line
}
return config;
};