question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module not found. attempted require...

See original GitHub issue

I get an error when using prerender-loader. It seems to fail with the below error. I traced it to this line and it appears that the only keys in compilation.assets are ssr-bundle.js. Any suggestions?

 '  Error: Child compilation failed:\n  Module build failed (from ./node_modules/prerender-loader/dist/prerender-loader.js):\n  Error: Error:  Module not found. attempted require("url")\n  \n  - index.js:190 runChildCompiler.then.window.require\n    [account-web]/[prerender-loader]/src/index.js:190:19\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  - Error: Error:  Module not found. attempted require("url")\n  \n  - compiler.js:79 childCompiler.runAsChild\n    [account-web]/[react-app]/[html-webpack-plugin]/lib/compiler.js:79:16\n  \n  - Compiler.js:296 compile\n    [account-web]/[react-app]/[webpack]/lib/Compiler.js:296:11\n  \n  - Compiler.js:553 hooks.afterCompile.callAsync.err\n    [account-web]/[react-app]/[webpack]/lib/Compiler.js:553:14\n  \n  \n  - Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]\n    [account-web]/[react-app]/[tapable]/lib/Hook.js:35:21\n  \n  - Compiler.js:550 compilation.seal.err\n    [account-web]/[react-app]/[webpack]/lib/Compiler.js:550:30\n  \n  \n  - Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]\n    [account-web]/[react-app]/[tapable]/lib/Hook.js:35:21\n  \n  - Compilation.js:1294 hooks.optimizeAssets.callAsync.err\n    [account-web]/[react-app]/[webpack]/lib/Compilation.js:1294:35\n  \n  \n  - Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]\n    [account-web]/[react-app]/[tapable]/lib/Hook.js:35:21\n  \n  - Compilation.js:1285 hooks.optimizeChunkAssets.callAsync.err\n    [account-web]/[react-app]/[webpack]/lib/Compilation.js:1285:32\n  \n  \n  - Hook.js:35 AsyncSeriesHook.lazyCompileHook [as _callAsync]\n    [account-web]/[react-app]/[tapable]/lib/Hook.js:35:21\n  \n  - Compilation.js:1280 hooks.additionalAssets.callAsync.err\n    [account-web]/[react-app]/[webpack]/lib/Compilation.js:1280:36\n  \n  \n' ]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
hugmanriquecommented, Oct 26, 2018

I know this is a real issue, but this plugin isn’t designed to be used in development mode (with hot-reloading libraries): you should only need to apply it on a production build (with no added code from webpack hot-reloading libraries)

1reaction
developitcommented, Feb 22, 2019

Regarding conditional escaping, you can do this:

if (self.PRERENDER) {
  // code is being run in prerender-loader
}
else {
  // code is being run in browser
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

You attempted to import /node_modules/react-refresh/runtime ...
Module not found : Error: You attempted to import .../node_modules/react-refresh/runtime.js which falls outside of the project src/ directory.
Read more >
Module not found Error: You attempted to import which falls ...
I think path for your Player component is incorrect import Player from "../components/Player";. Try this: import Player from ".
Read more >
module-not-found - Next.js
A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies;...
Read more >
Troubleshoot Azure IoT Edge common errors - Microsoft Learn
Use this article to identify and resolve common issues when using IoT Edge solutions. If you need information on how to find logs...
Read more >
Have a JavaScript Module Not Found Error ... - Airbrake Blog
If you're seeing a "module not found: error: can't resolve," in your Javascript code, here's an explanation as to why and how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found