Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
// load env
this.loadEnv();
// init plugins
this.initPlugins();
// reload user config
const userConfig = new UserConfig(this);
const config = userConfig.getConfig({ force: true });
mergeConfig(this.config, config);
this.userConfig = userConfig;
if (config.browserslist) {
deprecate('config.browserslist', 'use config.targets instead');
}
debug('got user config');
debug(this.config);
// assign user's outputPath config to paths object
if (config.outputPath) {
const { paths } = this;
paths.outputPath = config.outputPath;
paths.absOutputPath = join(paths.cwd, config.outputPath);
}
debug('got paths');
debug(this.paths);
}
}
// /path -> /path.html
if (route.path && config.exportStatic && config.exportStatic.htmlSuffix) {
route.path = addHtmlSuffix(route.path, !!route.routes);
}
// 权限路由
// TODO: use config from config.routes
if (config.pages && config.pages[route.path] && config.pages[route.path].Route) {
route.Route = config.pages[route.path].Route;
}
// Compatible the meta.Route and warn deprecated
if (route.meta && route.meta.Route) {
deprecate('route.meta.Route', 'use route.Route instead');
route.Route = route.meta.Route;
delete route.meta;
}
if (onPatchRoute) onPatchRoute(route);
if (route.routes) {
patchRoutes(route.routes, config, isProduction, onPatchRoute);
}
}