Skip to content
This repository was archived by the owner on Jul 13, 2021. It is now read-only.
This repository was archived by the owner on Jul 13, 2021. It is now read-only.

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

@Sawtaytoes

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions