webpack-hot-client icon indicating copy to clipboard operation
webpack-hot-client copied to clipboard

Error when loading webpack-hot-client from a package that brings it in

Open Sawtaytoes opened this issue 5 years ago • 1 comments

  • Operating System: Windows 10 64-bit
  • Node Version: 8.11.3
  • yarn Version: 1.8.0
  • webpack Version: 4.16.0
  • webpack-hot-client Version: 4.1.1

Expected Behavior

Webpack-Hot-Client loads as usual.

Actual Behavior

ERROR in multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch ./app/entrypoints/client
Module not found: Error: Can't resolve 'webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e' in '[FULL PROJECT PATH]'
 @ multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch ./app/entrypoints/client app[0]

ERROR in multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch [NODE_MODULES_PATH]/app/entrypoints/clientTests
Module not found: Error: Can't resolve 'webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e' in '[FULL PROJECT PATH]'
 @ multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch ../apps-client-packages/app/entrypoints/clientTests tests[0]

ERROR in multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch ./app/entrypoints/angularJs
Module not found: Error: Can't resolve 'webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e' in '[FULL PROJECT PATH]'
 @ multi webpack-hot-client/client?4fabb837-9d08-4ee3-a3c2-5a114dfd758e react-hot-loader/patch ./app/entrypoints/angularJs angularJs[0]

I receive this error probably because the app I'm in brings in another package which itself has webpack-hot-client pulled in. It's looking in ./app instead of app. None of these files are in the relative root of the config file ./. For whatever reason, this works in the package, but not when the package is running from node_modules/.

Outputting the entrypoint paths, I'm seeing this:

client [FULL PROJECT PATH]\app\entrypoints\client
clientTests [NODE_MODULES PATH]\app\entrypoints\clientTests
angularJs [FULL PROJECT PATH]\app\entrypoints\angularJs

I don't exactly know what's going on here.

Code

index.js

require('app-module-path/register')
require('package-in-node-modules')

Package's index.js

require('app-module-path/register')
require('scripts/runWebpack')()

Package's Webpack config

  entry: {
    app: [
      'react-hot-loader/patch',
      '[FULL PROJECT PATH]\app\entrypoints\client',
    ],
    tests: [
      'react-hot-loader/patch',
      '[NODE_MODULES PATH]\app\entrypoints\clientTests',
    ],
    angularJs: [
      'react-hot-loader/patch',
      '[FULL PROJECT PATH]\app\entrypoints\angularJs',
   ],
  },

How Do We Reproduce?

Create an npm package that contains the webpack code and run that code from an app that uses that npm package. That's how I'm doing it at least. Seems to be the only difference between the two.

Sawtaytoes avatar Jul 13 '18 23:07 Sawtaytoes

You win the prize for most issues on this repo in a day 🎉 I'm not sure what the prize will be, but I'll come up with something nice.

On a non-silly note, we've got a fair amount of tests and this module is used by webpack-serve fairly successfully by a few thousand daily users. I'm not saying that there isn't the possibility of issues with the module, but you seem to be running into quite a few that haven't previously been an issue. In getting this to work, you're reporting bug issues, but what you're looking for is support in getting this running in your environment - and that's something we don't provide here. There's an issue type explaining some support vectors that you can give a try as well.

We'll leave this open for discussion for a few weeks, but I would encourage you to try and find the source of an issue you run into, before opening an issue on the repo. Not bad vibes meant; using the issues as a message board for help isn't something we're down with, and why we point folks towards the Gitter and StackOverflow.

shellscape avatar Jul 13 '18 23:07 shellscape