react-refresh-webpack-plugin icon indicating copy to clipboard operation
react-refresh-webpack-plugin copied to clipboard

Relative imports outside of src/ are not supported.

Open auxon opened this issue 2 years ago • 6 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.

auxon avatar Aug 31 '23 14:08 auxon

This is an error from react-scripts I believe?

pmmmwh avatar Aug 31 '23 15:08 pmmmwh

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

auxon avatar Sep 01 '23 01:09 auxon

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

pmmmwh avatar Sep 01 '23 23:09 pmmmwh

@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.

auxon avatar Sep 02 '23 21:09 auxon

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,
      }),

auxon avatar Sep 02 '23 21:09 auxon

@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).

auxon avatar Sep 02 '23 21:09 auxon

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

pmmmwh avatar Jun 02 '24 23:06 pmmmwh