function ExamplesCompiler()

in packages/docpack-examples-compiler/lib/ExamplesCompiler.js [54:85]


function ExamplesCompiler(compilation, config) {
  if (this instanceof ExamplesCompiler == false) {
    return new ExamplesCompiler(compilation, config);
  }

  this.files = [];
  this.config = merge(defaultConfig, config || {});

  ChildCompiler.call(this, compilation, this.config);
  var compiler = this._compiler;

  /**
   * We need to create named entries, so child compiler output
   * filename should be set to [name] (name of entry)
   */
  compiler.options.output.filename = '[name].js';


  this._compiler.apply(
    new JsonpTemplatePlugin()
  );

  /**
   * We will extract example files content for compilation via special loader,
   * so we share array with example files between compiler and loader
   */
  loader.plugInCompiler(compiler, this.files);

  if (this.config.applyParentCompilerPlugins) {
    this.applyParentCompilerPlugins();
  }
}