Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { cwd = process.cwd(), entry } = opts;
const babel = resolve(__dirname, './babel.js');
const paths = getPaths(cwd);
// register babel for config files
registerBabel(babel, {
cwd,
configOnly: true,
});
// get user config
let config = null;
let returnedWatchConfig = null;
try {
const configObj = getConfig({ cwd });
({ config } = configObj);
returnedWatchConfig = configObj.watch;
debug(`user config: ${JSON.stringify(config)}`);
} catch (e) {
console.error(chalk.red(e.message));
debug('Get .webpackrc config failed, watch config and reload');
// 监听配置项变更,然后重新执行 dev 逻辑
watchConfigs().on('all', (event, path) => {
debug(`[${event}] ${path}, unwatch and reload`);
unwatchConfigs();
runDev(opts);
});
return;
}