webpack

package
v0.0.0-...-1535236 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 15 Imported by: 0

README

Webpack Middleware

This package implements a basic webpack dev server middleware, useful for serving assets in the development environment.

Usage

TODO: In the meantime, see webpack_test.go

Development

This package uses a real instance of the webpack dev server for a complete integration test. To ensure tests will pass, run npm install and validate that npx webpack serve works within the test_env directory.

Contributing

Bug fixes and minor improvements are welcome in the form of Pull Requests. For larger changes please open issue to discuss the proposed change first.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Webpack

type Webpack struct {
	// Path to Webpack binary
	BinPath string
	// Root dir to start webpack from
	RootDir string
	// Port for webpack to serve assets from
	Port int
	// contains filtered or unexported fields
}

Webpack is used to start and stop a webpack dev server instance. It can be used with medium/pkg/medium via the Middleware method, serving assets from the /assets path in the target application.

func New

func New() *Webpack

func (*Webpack) Middleware

func (w *Webpack) Middleware() medium.Middleware

Middleware accepts a logger and returns a middleware that can be used in conjunction with medium.Use.

The middleware expects for webpack to be executable in the current working directory.

This is not intended for production use, just for development.

func (*Webpack) Start

func (w *Webpack) Start(ctx context.Context, out io.Writer) error

func (*Webpack) Stop

func (w *Webpack) Stop() error

func (*Webpack) Wait

func (w *Webpack) Wait() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL