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

Entry module not found: Error: Can't resolve 'prerender-loader' #9

Open
JaceHensley opened this issue Jun 4, 2018 · 8 comments
Open

Comments

@JaceHensley
Copy link

JaceHensley commented Jun 4, 2018

Hey there! So this is probably something I'm doing wrong but I'd appreciate any help.

This is what I have in my plugins section

...routes.map(url =>
  new HtmlWebpackPlugin({
    filename: `${paths.clientPublic}${url}index.html`,
    template: `!!prerender-loader?string!${paths.clientHtml}`,
  })
),

This is the error I am getting

Error: Child compilation failed:
  Entry module not found: Error: Can't resolve 'prerender-loader' in '/Users/jace/...':
  Error: Can't resolve 'prerender-loader' in '/Users/jace/...'

I have installed via yarn add --dev https://github.com/havenchyk/prerender-loader#47a6ec31715930a17ed5eca8d4637f0d57707ed5 (because I need the multiple entry support)

Any help would be great, thank you!

@jesperjohansson
Copy link

Try cding into node_modules/prerender-loader and run yarn and yarn build and then try again

@JaceHensley
Copy link
Author

JaceHensley commented Jun 4, 2018

So I get a different error when I do that. During build (within node_modules/prerender-loader) I get the following:

yarn build                                                                                                                                                                           23s 883ms
yarn run v1.7.0
$ microbundle -f cjs --no-compress --external all
'os' is imported by src/index.js, but could not be resolved – treating it as an external dependency
'webpack/lib/LibraryTemplatePlugin' is imported by src/index.js, but could not be resolved – treating it as an external dependency
'webpack/lib/node/NodeTemplatePlugin' is imported by src/index.js, but could not be resolved – treating it as an external dependency
'webpack/lib/node/NodeTargetPlugin' is imported by src/index.js, but could not be resolved – treating it as an external dependency
'webpack/lib/SingleEntryPlugin' is imported by src/index.js, but could not be resolved – treating it as an external dependency
Build output to dist:
      2.49 kB: prerender-loader.js
✨  Done in 1.83s.

And then when I start my client up I get this:

Error: Child compilation failed:
  Module build failed: TypeError: Cannot read property 'compilation' of undefined

  - DefinePlugin.js:51 DefinePlugin.apply
    [bloom-web]/[prerender-loader]/[webpack]/lib/DefinePlugin.js:51:18

  - index.js:117
    [bloom-web]/[prerender-loader]/src/index.js:117:6

  - new Promise

  - index.js:92 prerender
    [bloom-web]/[prerender-loader]/src/index.js:92:1


  - TypeError: Cannot read property 'compilation' of undefined

  - DefinePlugin.js:51 DefinePlugin.apply
    [bloom-web]/[prerender-loader]/[webpack]/lib/DefinePlugin.js:51:18

  - index.js:117
    [bloom-web]/[prerender-loader]/src/index.js:117:6

  - new Promise

  - index.js:92 prerender
    [bloom-web]/[prerender-loader]/src/index.js:92:1


  - compiler.js:76
    [bloom-web]/[html-webpack-plugin]/lib/compiler.js:76:16

@jesperjohansson
Copy link

jesperjohansson commented Jun 4, 2018

@JaceHensley Do you use DefinePlugin in your webpack config? Are you running your client using yarn webpack-serve? If yes, does it build if you use just yarn webpack?

@JaceHensley
Copy link
Author

Yes I am using that plugin right afterwards. I have the project setup via create-react-app and it has been exported.

Could this be do to using webpack 3.X and html-webpack-plugin 2.X?

@JaceHensley
Copy link
Author

And it's served via webpack-dev-server

@jesperjohansson
Copy link

@JaceHensley Is prerender-loader.js in the node_nodules/prerender-loader/dist folder?

@JaceHensley
Copy link
Author

Yes, after I do yarn && yarn build within node_nodules/prerender-loader/dist

@gujral1997
Copy link

I am facing the same issue and unable to fix it. Any progress on this?
PS: I am getting Error: Plugin 'jsx' not found when I do yarn build inside node_modules/prerender-loader

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

No branches or pull requests

3 participants