Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack 5 error: "Cannot find module 'webpack/lib/dependencies/SingleEntryDependency' " #431

Closed
edmorley opened this issue Dec 14, 2019 · 8 comments

Comments

@edmorley
Copy link

  • Operating System: OS X
  • Node Version: v13.3.0
  • NPM Version: N/A (yarn)
  • webpack Version: 5.0.0-beta.9
  • karma-webpack Version: 4.0.2

Expected Behavior

karma-webpack does not give errors about missing modules under webpack 5 beta.

Actual Behavior

 $ karma start --single-run
  14 12 2019 20:11:51.063:ERROR [plugin]: Error during loading "/tmp/create-project__preact___airbnb___karma_5gjvdzjeg85/node_modules/karma-webpack/dist/index.js" plugin:
    Cannot find module 'webpack/lib/dependencies/SingleEntryDependency'
  14 12 2019 20:11:51.327:ERROR [preprocess]: Can not load "webpack", it is not registered!
    Perhaps you are missing some plugin?

  START:
  14 12 2019 20:11:51.386:INFO [karma-server]: Karma v4.4.1 server started at http://0.0.0.0:9876/
  14 12 2019 20:11:51.387:INFO [launcher]: Launching browsers ChromeCI with concurrency unlimited
  14 12 2019 20:11:51.388:ERROR [karma-server]: Error: Found 2 load errors
      at Server.webServer.listen (/tmp/create-project__preact___airbnb___karma_5gjvdzjeg85/node_modules/karma/lib/server.js:192:27)
      at Object.onceWrapper (events.js:286:20)
      at Server.emit (events.js:203:15)
      at emitListeningNT (net.js:1314:10)
      at process._tickCallback (internal/process/next_tick.js:63:19)
  error Command failed with exit code 1.

Code

I can export a Neutrino config if really necessary, but this is reproduceable with any config.

How Do We Reproduce?

https://travis-ci.com/neutrinojs/neutrino/jobs/267299372

@edmorley
Copy link
Author

https://github.com/webpack/changelog-v5#minor-changes says:

SingleEntryPlugin and SingleEntryDependency removed
MIGRATION: use EntryPlugin and EntryDependency

@samal-rasmussen
Copy link

samal-rasmussen commented Nov 4, 2020

No commit or PR merge since june 10 2019. There was a PR for fixing this issue, but it was closed by the submitter. I don't know why, but I guess because of inactivity. This project looks dead. It is unfortunate now that Webpack 5 is out, and it is blocked on this issue.

EDIT:
Ok I have pulled in rahcusa's fix into a fork here:
https://github.com/samal-rasmussen/karma-webpack

I added some other minor changes too, which you can see in the commit log.

Npm is able to pull in packages directly from github, so you can use it directly in you package.json just like this:
"karma-webpack": "samal-rasmussen/karma-webpack#49410439564034bf2c89c5c13ba71a763f592380"

That points to a specific commit in the github fork, so you know what you are getting.

@himanshuapril1
Copy link

Team is already working on fixing. You can use https://github.com/ryanclark/karma-webpack/tree/next for latest Webpack5 configuration updates

@himanshuapril1
Copy link

No commit or PR merge since june 10 2019. There was a PR for fixing this issue, but it was closed by the submitter. I don't know why, but I guess because of inactivity. This project looks dead. It is unfortunate now that Webpack 5 is out, and it is blocked on this issue.

EDIT:
Ok I have pulled in rahcusa's fix into a fork here:
https://github.com/samal-rasmussen/karma-webpack

I added some other minor changes too, which you can see in the commit log.

Npm is able to pull in packages directly from github, so you can use it directly in you package.json just like this:
"karma-webpack": "samal-rasmussen/karma-webpack#49410439564034bf2c89c5c13ba71a763f592380"

That points to a specific commit in the github fork, so you know what you are getting.

@samal-rasmussen Right now it's throwing error with that src directory you have made in above commit id. Can you please fix it?

@samal-rasmussen
Copy link

That is great news.

Right now it's throwing error with that src directory you have made in above commit id. Can you please fix it?

I just tried clearing node_modules and fetching all packages again and rebuilding and running my tests in my project again. No issues. Could you share a bit more details about the issue you are seeing?

@himanshuapril1
Copy link

Please refer screenshot for error, which works fine if I change src to dist here https://github.com/samal-rasmussen/karma-webpack/blob/master/package.json#L10.
I guess this is mainly because that src directory doesn't gets published while installing from package.

Capture

Directory listing of node_modules after doing clean sweep.

ls node_modules/karma-webpack/
CHANGELOG.md  dist  LICENSE  node_modules  package.json  README.md

@codymikol
Copy link
Owner

To limit confusion, I am combining all threads for webpack 5 / karma6 support over here ==> #475

@codymikol
Copy link
Owner

v5 is now available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants