Home Reference Source
import ProjextWebpackOpenDevServer from 'projext-plugin-webpack/src/plugins/openDevServer/index.js'
public class | source

ProjextWebpackOpenDevServer

This is a webpack plugin that works as a tiny helper for the dev server: It logs clear messages when the bundle isbeing created, when it's available, in which URL and it even opens the browser. The reason it was created was because the dev server log messages are hard to find and, depending on the settings, when the dev server opens the browser, you can end up on /webpack-dev-server.

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private

The dev server URL.

Method Summary

Public Methods
public

apply(compiler: Object)

This is called by webpack when the plugin is being processed.

public

Gets the plugin options.

public

Gets the dev server URL.

Public Constructors

public constructor(url: string, options: ProjextWebpackOpenDevServerOptions) source

Params:

NameTypeAttributeDescription
url string

The dev server URL.

options ProjextWebpackOpenDevServerOptions
  • optional
  • default: {}

Settings to customize the plugin behaviour.

Throw:

Error

If url is not specified or if isn't a string.

Private Members

private _url: string source

The dev server URL.

Public Methods

public apply(compiler: Object) source

This is called by webpack when the plugin is being processed. The method takes care of adding the required listener to the webpack hooks in order to log the information messages and open the browser..

Params:

NameTypeAttributeDescription
compiler Object

The compiler information provided by webpack.

public getOptions(): ProjextWebpackOpenDevServerOptions source

Gets the plugin options.

public getURL(): string source

Gets the dev server URL.

Return:

string