DevServer

DevServer

new DevServer(script, optionsopt)

Source:
See:

A lightweight development server that rapidly recompiles the JavaScript and SASS files when they are edited and updates the page.

Utilizes the Webpack development server.

Includes react hot loader to further optimize the development process of the React applications.

Please install and enable the LiveReload browser extension for the CSS reloading to work.

Example
import {DevServer} from 'webcompiler';
// or - import {DevServer} from 'webcompiler/lib/DevServer';
// or - var DevServer = require('webcompiler').DevServer;
// or - var DevServer = require('webcompiler/lib/DevServer').DevServer;
import {join} from 'path';

const devDir = join(__dirname, '..', 'development'),
  script = join(devDir, 'script.js'),
  style = join(devDir, 'app.scss');

new DevServer(script, {style}).run();
// now navigate to http://localhost:3000 using your favorite browser ( preferably Chrome :) )
Parameters:
Name Type Attributes Default Description
script string

a full system path to a JavaScript file

options DevServerConfig <optional>
{}

optional configuration

Methods

run()

Source:

Starts the Webpack development server, compiles SASS and starts watching for file changes (only if the style option was specified)

watchJS()

Source:

Starts the Webpack development server

watchSASS()

Source:

Compile SASS and start watching for file changes