Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vutran/hot-reload-server
A simple webpack hot reload server using webpack-dev-middleware and webpack-hot-middleware
https://github.com/vutran/hot-reload-server
hot-reloading javascript node webpack
Last synced: 6 days ago
JSON representation
A simple webpack hot reload server using webpack-dev-middleware and webpack-hot-middleware
- Host: GitHub
- URL: https://github.com/vutran/hot-reload-server
- Owner: vutran
- License: mit
- Created: 2015-12-16T08:28:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T15:09:40.000Z (over 8 years ago)
- Last Synced: 2024-10-29T20:51:32.775Z (15 days ago)
- Topics: hot-reloading, javascript, node, webpack
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpack hot-reload-server
Simple hot reload server.
[![NPM](https://nodei.co/npm/hot-reload-server.png?compact=true)](https://nodei.co/npm/hot-reload-server/)
# Usage
**server.js**
````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**
````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**
````js
document.write('It works!');// check if HMR is enabled
if (module.hot) {
// accept itself
module.hot.accept();
}
````**index.html**
````js
````
# Changelog
## 0.1.0
- Rewritten as ES6 module
- Updated example## 0.0.4
- Exposed express and expres app instance