Socket
Socket
Sign inDemoInstall

hot-reload-server

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hot-reload-server

Simple hot reload server.


Version published
Weekly downloads
14
increased by55.56%
Maintainers
1
Install size
10.2 kB
Created
Weekly downloads
 

Readme

Source

webpack hot-reload-server

Simple hot reload server.

NPM

Usage

server.js

import path from 'path';
import webpackConfig from './webpack.config';
import hotReloadServer from '../index';

// create the server
let server = hotReloadServer(webpackConfig);

// expose the public directory
server.expose(path.join(__dirname, 'public'));

// start the server
server.start();

webpack.config.js

// Load modules
import path from 'path';
import webpack from 'webpack';

// Create an empty config
export default {
	entry: [
		'webpack-hot-middleware/client',
		path.join(__dirname, 'entry.js')
	],
	output: {
		path: __dirname,
    publicPath: '/',
		filename: 'bundle.js'
	},
	hotReloadServer: {
		address: 'localhost',
		port: 4000
	},
  devtool: '#source-map',
  plugins: [
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ]
};

entry.js

document.write('It works!');

// check if HMR is enabled
if(module.hot) {
    // accept itself
    module.hot.accept();
}

index.html

<script type="text/javascript" language="javascript" src="bundle.js"></script>

Changelog

0.1.0

  • Rewritten as ES6 module
  • Updated example

0.0.4

  • Exposed express and expres app instance

Keywords

FAQs

Last updated on 15 Feb 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc