Skip to content

Commit a31a96e

Browse files
authored
fix: error on hmr when file path is null (#213)
* Fixed documentation for Webpack output.library and libraryTarget: 'window' When building a library and use a multi entry config, only the last item in the entry array will be exposed. The example that was provided by the plugin would expose the webpack plugin serve client in the end file and it breaks the app * Fixed error breaking hmr filePath on webpack invalid hook can return filePath or null. This resolves the following error when it returns null Cannot read property 'replace' of null
1 parent 9fbe97b commit a31a96e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const setupRoutes = function setupRoutes() {
8080

8181
socket.invalid = (filePath = '<unknown>', compiler) => {
8282
const context = compiler.context || compiler.options.context || process.cwd();
83-
const fileName = (filePath.replace && filePath.replace(context, '')) || filePath;
83+
const fileName = (filePath && filePath.replace && filePath.replace(context, '')) || filePath;
8484
const { wpsId } = compiler;
8585

8686
send(prep({ action: 'invalid', data: { fileName, wpsId } }));

0 commit comments

Comments
 (0)