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

TypeError: Cannot read property 'hash' of undefined #37

Closed
mthines opened this issue Jun 25, 2019 · 5 comments
Closed

TypeError: Cannot read property 'hash' of undefined #37

mthines opened this issue Jun 25, 2019 · 5 comments

Comments

@mthines
Copy link

mthines commented Jun 25, 2019

Hey!
Awesome project!

I've been trying to setup the prerender, but i keep getting the following error:

/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:2285
                        hash.update(child.hash);
                                          ^
TypeError: Cannot read property 'hash' of undefined
Show full error message

/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:2285
                        hash.update(child.hash);
                                          ^

TypeError: Cannot read property 'hash' of undefined
    at Compilation.createHash (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:2285:22)
    at hooks.optimizeTree.callAsync.err (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1288:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1244:27)
    at hooks.make.callAsync.err (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:624:17)
    at _err0 (eval at create (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at _addModuleChain (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1095:12)
    at processModuleDependencies.err (/Users/madsthines/Workspace/Adapt/react_boilerplate/node_modules/react-scripts/node_modules/webpack/lib/Compilation.js:1007:9)
    at process._tickCallback (internal/process/next_tick.js:61:11)

My setup

I'm using CRA 3, Typescript and the Html Webpack Plugin.
I've installed the module with Yarn, and double checked it's in the package.json and in the actually node_modules folder.

// Use the correct index.html template.
new HtmlWebpackPlugin({
  inject: false,
  template: `!!prerender-loader?string&entry=./src/index.tsx!${paths.appHtml}`,
  favicon: `${paths.appPublic}/favicons/favicon.ico`,
  manifest: `/manifest.json`,
}),

I thought I might had the same issue as issue 25, but adding the entry, didn't help me.

Any thoughts on why I get this issue?

@vitaliyhayda
Copy link

same issue

@vitaliyhayda
Copy link

vitaliyhayda commented Oct 19, 2019

After correctly specifying entry, I was able to get another error:

ERROR in   Error: Child compilation failed:
      Module build failed (from ./node_modules/prerender-loader/dist/prerender-loader.js):
      NonErrorEmittedError: (Emitted value instead of an instance of Error) TypeError: window.URL.createObjectURL is not a function

@shuwenjunn
Copy link

Have you fixed it

@PLQin
Copy link

PLQin commented Jul 17, 2020

see mzgoddard/hard-source-webpack-plugin#416

It might solve your problem

@Hypnosphi
Copy link

@PLQin I tried rm -rf node_modules/.cache as suggested there, but it doesn't fix the problem

@vitaliyhayda how exactly did you fix your entry?

@mthines mthines closed this as completed Jan 6, 2021
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

5 participants