Skip to content

React-dev-utils/webpackHotDevCliet fails to create correct entry point for multipage apps #10304

@mljlynch

Description

@mljlynch

Describe the bug

I'm trying to set up a chrome extension with an ejected version of CRA - the React-dev-utils server leads to an error:

Uncaught DOMException: Failed to construct 'WebSocket': The URL '/sockjs-node' is invalid.

This is resolved by pointing the entry to

    entry: {
      app: paths.appIndexJs,
    },

instead of

        entry: {
            app: [
                // Include an alternative client for WebpackDevServer. A client's job is to
                // connect to WebpackDevServer by a socket and get notified about changes.
                // When you save a file, the client will either apply hot updates (in case
                // of CSS changes), or refresh the page (in case of JS changes). When you
                // make a syntax error, this client will display a syntax error overlay.
                // Note: instead of the default WebpackDevServer client, we use a custom one
                // to bring better experience for Create React App users. You can replace
                // the line below with these two lines if you prefer the stock client:
                // require.resolve('webpack-dev-server/client') + '?/',
                // require.resolve('webpack/hot/dev-server'),
                isEnvDevelopment &&
                require.resolve('react-dev-utils/webpackHotDevClient'),
                // Finally, this is your app's code:
                paths.appIndexJs,
                // We include the app code last so that if there is a runtime error during
                // initialization, it doesn't blow up the WebpackDevServer client, and
                // changing JS code would still trigger a refresh.
            ].filter(Boolean),

Did you try recovering your dependencies?

1.22.5

Environment

Environment Info:

current version of create-react-app: 4.0.1
running from /Users/Jake/.npm/_npx/58696/lib/node_modules/create-react-app

System:
OS: macOS 10.15.7
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm
Browsers:
Chrome: 87.0.4280.88
Edge: 87.0.664.66
Firefox: 81.0.1
Safari: 14.0
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found

Expected behavior

(Write what you thought would happen.)

Actual behavior

Uncaught DOMException: Failed to construct 'WebSocket': The URL '/sockjs-node' is invalid.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions