As long as the normal hot load as long as the following configuration is good
Package.json
{ "devdependencies": { "webpack": "^2.6.1", "webpack-dev-server": "^2.4.5" }, " Scripts ": { " start ":" Webpack-dev-server " }}
Webpack.config.js
Module.exports = { + '/js/test.js ', output: { // Note this is Publicpath publicpath: "/dist/", "Bundle_test.js" }}
To use ES6 syntax, load the Babel file, and note that you need to install BABEL-CLI first
Package.json as follows:
{ "devdependencies": { "babel-cli": "^6.24.1", "Babel-core": "^6.25.0" , "Babel-loader": "^7.0.0", "babel-preset-es2015": "^6.24.1", " Babel-preset-react ":" ^6.24.1 ", " Webpack ":" ^2.6.1 ", " webpack-dev-server ":" ^ 2.4.5 " }, " Scripts ": { " start ":" Webpack-dev-server "} }
Webpack.config.js as follows:
Module.exports = { + '/js/test.js ', output: { "/dist/", "bundle_test.js " }, module: { loaders: [ { /\.json$/, " Json-loader " } , { /\.js$/, "Babel-loader" } ]} }
and add a. babelrc file, as follows:
{ "presets": ["es2015", "React"]}
Webpack2 Hot Load JS file