How to use the egg.AgentWorkerLoader function in egg

To help you get started, we’ve selected a few egg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / beidou / packages / beidou-core / lib / core / loaders / agent-worker-loader.js View on Github external
const path = require('path');
const egg = require('egg');

/**
 * Agent Worker Loader, extend Egg.AgentWorkerLoader
 * @extends Egg.AgentWorkerLoader
 */
class BeidouAgentWorkerLoader extends egg.AgentWorkerLoader {
  // constructor(options) {
  //   super(options);
  // }

  loadConfig() {
    super.loadConfig();
    this.checkDevPlugins();
  }

  /**
   * check plugins, all plugins must be installed in dependency
   */
  checkDevPlugins() {
    const appPkg = require(path.join(this.options.baseDir, './package.json'));
    Object.keys(this.plugins).forEach((key) => {
      const plugin = this.plugins[key];