entry中添加了HMR相关文件,同时添加HMR插件以修复热重载不生效的问题
This commit is contained in:
parent
6b01e3718b
commit
c18e7c94ff
|
|
@ -235,7 +235,14 @@ module.exports = function (webpackEnv) {
|
||||||
(shouldUseSourceMap ? 'source-map' : isEnvStaging ? 'eval-cheap-module-source-map' : 'nosources-source-map'),
|
(shouldUseSourceMap ? 'source-map' : isEnvStaging ? 'eval-cheap-module-source-map' : 'nosources-source-map'),
|
||||||
// These are the "entry points" to our application.
|
// These are the "entry points" to our application.
|
||||||
// This means they will be the "root" imports that are included in JS bundle.
|
// This means they will be the "root" imports that are included in JS bundle.
|
||||||
entry: paths.appIndexJs,
|
entry: [
|
||||||
|
// 模块热替换的运行时代码
|
||||||
|
'webpack/hot/dev-server.js',
|
||||||
|
// 用于 web 套接字传输、热重载逻辑的 web server 客户端
|
||||||
|
'webpack-dev-server/client/index.js?hot=true&live-reload=true',
|
||||||
|
// oak项目入口
|
||||||
|
paths.appIndexJs,
|
||||||
|
],
|
||||||
output: {
|
output: {
|
||||||
// The build folder.
|
// The build folder.
|
||||||
path: paths.appBuild,
|
path: paths.appBuild,
|
||||||
|
|
@ -802,6 +809,8 @@ module.exports = function (webpackEnv) {
|
||||||
: undefined
|
: undefined
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
// 添加HMR插件支持
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
// Inlines the webpack runtime script. This script is too small to warrant
|
// Inlines the webpack runtime script. This script is too small to warrant
|
||||||
// a network request.
|
// a network request.
|
||||||
// https://github.com/facebook/create-react-app/issues/5358
|
// https://github.com/facebook/create-react-app/issues/5358
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue