Home Reference Source
import ProjextWebpackUtils from 'projext-plugin-webpack/src/plugins/utils.js'
public class | source

ProjextWebpackUtils

This is a set of utility methods the Projext webpack plugins use.

Static Method Summary

Static Public Methods
public static

createLogger(plugin: string, logger: Logger): Logger

Validate and create a Logger instance for a plugin.

Static Public Methods

public static createLogger(plugin: string, logger: Logger): Logger source

Validate and create a Logger instance for a plugin. If the logger the plugin received on its options is an instance of Logger or has the same interface, it will "accept it" and return it; If the plugin didn't receive a logger, it will create a new instance of Logger and return it, but if the received logger is an invalid object, it will throw an error.

Params:

NameTypeAttributeDescription
plugin string

The plugin's instance name.

logger Logger
  • nullable: true

The logger the plugin received on its options.

Return:

Logger

Throw:

Error

If the logger the plugin received is not an instance of Logger and it doesn't have the same methods.