Javascript 网页包HMR无法更新
更改客户端上的某些文件后的浏览器控制台:Javascript 网页包HMR无法更新,javascript,node.js,typescript,webpack,moleculer,Javascript,Node.js,Typescript,Webpack,Moleculer,更改客户端上的某些文件后的浏览器控制台: // browser path @ http://localhost:3000/settings/ [HMR] bundle rebuilding [HMR] bundle rebuilt in 950ms [HMR] Checking for updates on the server... [HMR] Update check failed: Error: Manifest request to /90250042517446ecd3ba.hot-
// browser path @ http://localhost:3000/settings/
[HMR] bundle rebuilding
[HMR] bundle rebuilt in 950ms
[HMR] Checking for updates on the server...
[HMR] Update check failed: Error: Manifest request to /90250042517446ecd3ba.hot-update.json timed out.
at XMLHttpRequest.request.onreadystatechange (http://localhost:3000/app.js:42:16)
GET http://localhost:3000/90250042517446ecd3ba.hot-update.json net::ERR_CONNECTION_REFUSED
Uncaught (in promise) Error: Manifest request to /90250042517446ecd3ba.hot-update.json timed out.
at XMLHttpRequest.request.onreadystatechange (bootstrap:41)
GET http://localhost:3000/__webpack_hmr net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
mypackage.json脚本
"dev": "npm run lint && tsc-watch --onSuccess \"ts-node ./node_modules/moleculer/bin/moleculer-runner.js --envfile ./deploy/.env --hot --repl --config moleculer.config.ts ./services/**/*.service.ts\"",
我的网页包配置:
// webpack.config.js
module.exports = {
.......,
entry: {
app: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'frontend', 'main.tsx'),
],
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name].js',
publicPath: '/',
},
}
在后端
// services/api.service.ts
import devMiddleware from 'webpack-dev-middleware';
import hotMiddleware from 'webpack-hot-middleware';
// route middlewares @ GET /settings
............
use: [
compression(),
devMiddleware(compiler, {
noInfo: true,
publicPath: config.output.publicPath,
headers: { 'Access-Control-Allow-Origin': '*' },
}),
// Webpack hot replacement
hotMiddleware(compiler, {
log: broker.logger.info,
}),
ApiGateway.serveStatic('./public'),
],
.............
似乎每次我在客户端上更改某些内容时,服务器也会重新启动,我认为情况并非如此
请让我知道,如果有任何其他相关信息,我需要提供