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

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

node.js - Express and Redis - If session exists for this user, don't allow access -