Can I use hot module replacement with webpack but not use react? -


i tried using hot module replacement never succeed. found repository, can use hot module replacement well. , uses react-hot loader, if remove loader, i'll error:

[hmr] cannot find update. need full reload!  

i adjust project according above repository, i'm not using react, don't use react-hot loader, above error.

can use hot module replacement webpack not use react? or need xx-hot loader make hot module replaceable?

my structure:

src     entry.js index.html server.js webpack.config.js 

index.html:

<!doctype html> <html lang="en">     <head>         <meta charset="utf-8">         <title>document</title>     </head>     <body>         <script src="/static/bundle.js"></script>     </body> </html> 

entry.js:

document.write('hello'); 

server.js:

var webpack = require('webpack'); var webpackdevserver = require('webpack-dev-server'); var config = require('./webpack.config');  new webpackdevserver(webpack(config), {   publicpath: config.output.publicpath,   hot: true,   historyapifallback: true }).listen(3000, 'localhost', function (err, result) {   if (err) {     console.log(err);   }    console.log('listening @ localhost:3000'); }); 

webpack.config.js:

var path = require("path"); var webpack = require('webpack');  module.exports = {     devtool: 'eval',     entry: [         'webpack-dev-server/client?http://localhost:3000',         'webpack/hot/only-dev-server',         "./src/entry.js"     ],     output: {         path: path.join(__dirname, "build"),         publicpath: '/static/',         filename: "bundle.js"     },     plugins: [       new webpack.hotmodulereplacementplugin()     ] }; 

to support hmr, module should define - @ least - module.hot.accept true. documentation defines api describe how module should reloaded might need implement. maybe have react hot loader see how have done it.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -