pmmmwh / react-refresh-webpack-plugin

A Webpack plugin to enable "Fast Refresh" (also previously known as Hot Reloading) for React components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Relative imports outside of src/ are not supported.

auxon opened this issue · comments

I get this error on MacOS but not Windows:

Module not found: Error: You attempted to import /Users/rah/repos/web/ReaderCore/WebInterpreter/v3/node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/index.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

This is the only module causing this issue. Any ideas?

I updated to the latest version today to see if it would be fixed but it's still a problem.

This is an error from react-scripts I believe?

@pmmmwh I think so; I'm really confused by this one.

Can you show more of your setup? Webpack, package.json, or however you are running your app?

@pmmmwh I made a new create-react-app with typescript installed after the fact, then eject it, and compared my webpack.config.js to the new one and just changed a few lines to put back my required customizations, and suddently it works again. It's very odd. I am trying to track down the difference that broke it.

Ah, it's the overlay set to true that causes the issue. The default for create-react-app is false, but I switched it to true. I guess there's an issue with this on Macs.

      new ReactRefreshWebpackPlugin({
        overlay: true,
      }),

@pmmmwh Confirmed ... you can duplicate the issue with a default create-react-app, ejected, and set the overlay to false in the webpack.config.js, but it doesn't seem to be an issue on Windows. I'm running on a Macbook Air M1 2020, with Ventura 13.4.1 (c) (22F770820d).

This is a restriction from react-scripts - nothing to do with this plugin / it's compatibility.