Git Product home page Git Product logo

webpack-serve's Introduction

webpack-serve

tests cover size

webpack-serve

A CLI for webpack-plugin-serve - A Webpack development server in a plugin.

(While using a CLI such as webpack-serve is convenient, we recommend using webpack-plugin-serve directly in your webpack config, with webpack-nano, instead.)

Please consider donating if you find this project useful.

Requirements

webpack-serve is an evergreen ๐ŸŒฒ module.

This module requires an Active LTS Node version (v8.0.0+ or v10.0.0+). The client scripts in this module require browsers which support async/await. Users may also choose to compile the client script via an appropriately configured Babel webpack loader for use in older browsers.

Feature Parity

Since this CLI leverages webpack-plugin-serve, the same feature parity information applies. Please see the webpack-plugin-serve Feature Comparison for more information.

Install

Using npm:

npm install webpack-serve --save-dev

Usage

A CLI for webpack-plugin-serve, providing a premier webpack development server

Usage
  $ webpack-serve [...options]

Options
  --all               Apply webpack-plugin-serve to all compilers in the config
  --client.address    Overrides the WebSocket address in the client
  --client.retry      Instructs the client to attempt to reconnect all WebSockets when interrupted
  --client.silent     Instructs the client not to log anything to the console.
  --compress          Enables compression middleware which serves files with GZip compression.
  --config            A path to a webpack config file
  --config.{name}     A path to a webpack config file, and the config name to run
  --help              Displays this message
  --history-fallback  Enables History API Fallback
  --hmr               Enables Hot Module Replacement. On by default
  --host              Sets the host the server should listen from
  --http2             Instructs the server to enable HTTP2
  --live-reload       Instructs the client to perform a full page reload after each build
  --no-watch          Does not apply \`watch: true\` to the config, allowing for greater customization
  --open              Opens the default browser to the set host and port
  --port              Sets the port on which the server should listen
  --progress          Shows build progress in the client
  --silent            Instruct the CLI to produce no console output
  --static            Sets the directory from which static files will be served
  --status            Shows build status (errors, warnings) in the client
  --version           Displays webpack-nano and webpack versions
  --wait-for-build    Instructs the server to halt middleware processing until the current build is done.

Examples
  $ webpack-serve
  $ webpack-serve --help
  $ webpack-serve --config webpack.config.js
  $ webpack-serve --config.serve webpack.config.js

Flags

Please reference the webpack-plugin-serve Options for information and use. Most options are analogous to the flags listed above.

--no-watch

By default, the CLI will apply watch: true to the first config in the targeted webpack config file. To customize watching or watchOptions, please use this flag and customize the config(s) accordingly.

package.json Options

For convenience, webpack-plugin-serve options can also be defined in a package.json file. This CLI will look for a serve key in the nearest package.json beginning in the directory containing the specified webpack.config.js, up to the current working directory. Please reference the webpack-plugin-serve Options for information and use.

For Example:

{
	"name": "some-package",
	"version": "1.0.0",
	"serve": {
    "host": "10.10.10.1"
  }
}

Advanced Options

For options which require providing functions or complex objects like Promises which cannot be represented by JSON, nor on the command line, please use webpack-plugin-serve directly in your webpack config, along with webpack-nano.

Meta

CONTRIBUTING

LICENSE (Mozilla Public License)

webpack-serve's People

Contributors

8eecf0d2 avatar alecmev avatar bebraw avatar billyjanitsch avatar budmc29 avatar darrinm avatar dependabot[bot] avatar elisherer avatar elrumordelaluz avatar evilebottnawi avatar ferdinando-ferreira avatar frenzzy avatar hipstersmoothie avatar jounqin avatar madhavarshney avatar matheus1lva avatar mloughry avatar ndelangen avatar nihgwu avatar ooflorent avatar seebiscuit avatar shellscape avatar sibiraj-s avatar smably avatar tjallingt avatar trevorburnham avatar wkovacs64 avatar zenflow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webpack-serve's Issues

Proxy request to external server

I'm migrating from create-react-app (which if I'm not mistaken uses webpack-dev-server) allows a user to define a "proxy" setting to forward requests to a different url, for example I'd like to proxy requests from /graphql to localhost:8080/graphql

Is this possible with webpack-serve, or would I have to hard-code different API urls during dev vs prod?

'watch' needed in the target webpack config - not mentioned

Documentation Is:

  • Missing
  • Needed
  • Confusing
  • Not Sure?

Please Explain in Detail...

v3 is applying the entry and plugin for the user, but not watch: true.

The README makes no mention of the fact this key is required for the plugin to function correctly, thus anyone picking the plugin up will see webpack compile and exit!

Your Proposal for Changes

Either this should be applied for the user like entry and plugin, or the user should be told they need this in their webpack config (just like webpack-plugin-serve does).

e.g.
watch: true // โ† important: webpack and the server will continue to run in watch mode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.