Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 无法使网页包HMR工作_Webpack_Webpack Dev Server - Fatal编程技术网

Webpack 无法使网页包HMR工作

Webpack 无法使网页包HMR工作,webpack,webpack-dev-server,Webpack,Webpack Dev Server,最新网页包和网页包开发服务器 webpack.config(类型脚本): test.ts: console.log('test app here') module.hot.accept() 服务器控制台输出: [at-loader] Checking started in a separate process... client-webpack_1 | client-webpack_1 | [at-loader] Ok, 2.672 sec. client-webpack_1 | cl

最新网页包和网页包开发服务器

webpack.config(类型脚本):

test.ts:

console.log('test app here')

module.hot.accept()
服务器控制台输出:

[at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 2.672 sec.
client-webpack_1  |
client-webpack_1  | [at-loader] Using typescript@2.4.2 from typescript and "tsconfig.json" from /app/tsconfig.json.
client-webpack_1  |
client-webpack_1  |
client-webpack_1  | [at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 3.527 sec.
client-webpack_1  | Hash: fd98bbcdafd2f3861dd6
client-webpack_1  | Version: webpack 3.5.5
client-webpack_1  | Time: 9690ms
client-webpack_1  |      Asset       Size  Chunks             Chunk Names
client-webpack_1  |   build.js    27.9 kB       0  [emitted]  build
client-webpack_1  | index.html  184 bytes          [emitted]
client-webpack_1  |    [0] ./test.ts 53 bytes {0} [built]
client-webpack_1  | Child html-webpack-plugin for "index.html":
client-webpack_1  |          Asset    Size  Chunks  Chunk Names
client-webpack_1  |     index.html  586 kB       0
client-webpack_1  |        [0] ./webpack/node_modules/html-webpack-plugin/lib/loader.js!./webpack/node_modules/html-web
pack-plugin/default_index.ejs 538 bytes {0} [built]
client-webpack_1  |        [1] ./webpack/node_modules/lodash/lodash.js 540 kB {0} [built]
client-webpack_1  |        [2] (webpack)/buildin/global.js 509 bytes {0} [built]
client-webpack_1  |        [3] (webpack)/buildin/module.js 517 bytes {0} [built]
client-webpack_1  | webpack: Compiled successfully.
client-webpack_1  | webpack: Compiling...
client-webpack_1  |
client-webpack_1  | [at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 0.003 sec.
client-webpack_1  | Hash: 22b4a5abcf6d108e1fd4
client-webpack_1  | Version: webpack 3.5.5
client-webpack_1  | Time: 394ms
client-webpack_1  |                                Asset       Size  Chunks             Chunk Names
client-webpack_1  | 4b8c70cb56fb58c7b8fb.hot-update.json   44 bytes          [emitted]
client-webpack_1  |                             build.js    27.9 kB       0  [emitted]  build
client-webpack_1  | fd98bbcdafd2f3861dd6.hot-update.json   35 bytes          [emitted]
client-webpack_1  |                           index.html  184 bytes          [emitted]
client-webpack_1  |    [0] ./test.ts 53 bytes {0}
client-webpack_1  | Child html-webpack-plugin for "index.html":
client-webpack_1  |                                    Asset      Size  Chunks             Chunk Names
client-webpack_1  |                               index.html    586 kB       1
client-webpack_1  |     4b8c70cb56fb58c7b8fb.hot-update.json  44 bytes          [emitted]
client-webpack_1  |        [0] ./webpack/node_modules/html-webpack-plugin/lib/loader.js!./webpack/node_modules/html-web
pack-plugin/default_index.ejs 538 bytes {1}
client-webpack_1  |        [1] ./webpack/node_modules/lodash/lodash.js 540 kB {1}
client-webpack_1  |        [2] (webpack)/buildin/global.js 509 bytes {1}
client-webpack_1  |        [3] (webpack)/buildin/module.js 517 bytes {1}
client-webpack_1  | webpack: Compiled successfully.
test.ts:1 test app here
客户端控制台输出:

[at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 2.672 sec.
client-webpack_1  |
client-webpack_1  | [at-loader] Using typescript@2.4.2 from typescript and "tsconfig.json" from /app/tsconfig.json.
client-webpack_1  |
client-webpack_1  |
client-webpack_1  | [at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 3.527 sec.
client-webpack_1  | Hash: fd98bbcdafd2f3861dd6
client-webpack_1  | Version: webpack 3.5.5
client-webpack_1  | Time: 9690ms
client-webpack_1  |      Asset       Size  Chunks             Chunk Names
client-webpack_1  |   build.js    27.9 kB       0  [emitted]  build
client-webpack_1  | index.html  184 bytes          [emitted]
client-webpack_1  |    [0] ./test.ts 53 bytes {0} [built]
client-webpack_1  | Child html-webpack-plugin for "index.html":
client-webpack_1  |          Asset    Size  Chunks  Chunk Names
client-webpack_1  |     index.html  586 kB       0
client-webpack_1  |        [0] ./webpack/node_modules/html-webpack-plugin/lib/loader.js!./webpack/node_modules/html-web
pack-plugin/default_index.ejs 538 bytes {0} [built]
client-webpack_1  |        [1] ./webpack/node_modules/lodash/lodash.js 540 kB {0} [built]
client-webpack_1  |        [2] (webpack)/buildin/global.js 509 bytes {0} [built]
client-webpack_1  |        [3] (webpack)/buildin/module.js 517 bytes {0} [built]
client-webpack_1  | webpack: Compiled successfully.
client-webpack_1  | webpack: Compiling...
client-webpack_1  |
client-webpack_1  | [at-loader] Checking started in a separate process...
client-webpack_1  |
client-webpack_1  | [at-loader] Ok, 0.003 sec.
client-webpack_1  | Hash: 22b4a5abcf6d108e1fd4
client-webpack_1  | Version: webpack 3.5.5
client-webpack_1  | Time: 394ms
client-webpack_1  |                                Asset       Size  Chunks             Chunk Names
client-webpack_1  | 4b8c70cb56fb58c7b8fb.hot-update.json   44 bytes          [emitted]
client-webpack_1  |                             build.js    27.9 kB       0  [emitted]  build
client-webpack_1  | fd98bbcdafd2f3861dd6.hot-update.json   35 bytes          [emitted]
client-webpack_1  |                           index.html  184 bytes          [emitted]
client-webpack_1  |    [0] ./test.ts 53 bytes {0}
client-webpack_1  | Child html-webpack-plugin for "index.html":
client-webpack_1  |                                    Asset      Size  Chunks             Chunk Names
client-webpack_1  |                               index.html    586 kB       1
client-webpack_1  |     4b8c70cb56fb58c7b8fb.hot-update.json  44 bytes          [emitted]
client-webpack_1  |        [0] ./webpack/node_modules/html-webpack-plugin/lib/loader.js!./webpack/node_modules/html-web
pack-plugin/default_index.ejs 538 bytes {1}
client-webpack_1  |        [1] ./webpack/node_modules/lodash/lodash.js 540 kB {1}
client-webpack_1  |        [2] (webpack)/buildin/global.js 509 bytes {1}
client-webpack_1  |        [3] (webpack)/buildin/module.js 517 bytes {1}
client-webpack_1  | webpack: Compiled successfully.
test.ts:1 test app here
客户端控制台没有关于[WDS]或[HMR]的任何通知


如果我更改了一个文件,webpack会重新编译(在控制台中),但客户端不会做出反应。

问题是我需要添加特殊的开发人员入口点:

build: [
      resolve(__dirname, '../test'),
      'webpack-dev-server/client',
      'webpack/hot/only-dev-server'
    ]

同时也不要忘记,为解析添加适当的目录。模块应该解析这些模块中的哪些部分。

问题是我需要添加特殊的开发入口点:

build: [
      resolve(__dirname, '../test'),
      'webpack-dev-server/client',
      'webpack/hot/only-dev-server'
    ]

还有,别忘了,在
resolve.modules
中添加适当的目录,这些模块应该在哪里解析。

嘿,伙计,我在webpack.config.js中没有遇到任何
build
入口点?我在哪里添加这些?嘿,伙计,我在webpack.config.js中没有遇到任何
build
入口点?我在哪里添加这些?