How to deal with multiple entries

Author: HujianbooCreated Nov 17, 2021Updated Nov 17, 2021

webpack version: 5.59.1 webpack-dev-server version: 4.3.1 react version: 17.0.2

the document only gives the example of one entry. but now my project requires multiple entries just like this but does not work

entry: {
    'app':["react-hot-loader/patch","webpack-dev-server/client?http://localhost:8080","./index.tsx"],   
    'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js',   
    'json.worker': 'monaco-editor/esm/vs/language/json/json.worker',   
    'css.worker': 'monaco-editor/esm/vs/language/css/css.worker',   
    'html.worker': 'monaco-editor/esm/vs/language/html/html.worker',   
    'ts.worker': 'monaco-editor/esm/vs/language/typescript/ts.worker'
  },

I add the hot loader to every entry but also does not work.

entry: {
    'app':["react-hot-loader/patch","webpack-dev-server/client?http://localhost:8080","./index.tsx"],   
    'editor.worker': ['react-hot-lodaer/patch','monaco-editor/esm/vs/editor/editor.worker.js',]
    ......
  },

the error snapshot is this

image

Source: gaearon/react-hot-loader