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.

preact X type error

See original GitHub issue

I’m getting undefined is not an object (evaluating 'h.__H') after building with rc3,

	o (bundle.269f6.js:1:8826)
	i (bundle.269f6.js:1:8957)
	O (bundle.269f6.js:1:8604)
	O (bundle.269f6.js:1:16581)
	w (bundle.269f6.js:1:16048)
	k (bundle.269f6.js:1:17676)
	_ (bundle.269f6.js:1:13235)
	u (bundle.269f6.js:1:19075)
	pwNi (bundle.269f6.js:1:19106)
	e (bundle.269f6.js:1:106)
	(anonymous function) (bundle.269f6.js:1:1351)
	Global Code (bundle.269f6.js:1:1364)

what am I overlooking?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
JoviDeCroockcommented, Oct 11, 2019

When I look at the output of your bundle it’s pointing to different bundles of Preact (Preact seems to be bundled in multiple times)

Adding:

resolve: {
    // Add `.ts` and `.tsx` as a resolvable extension.
    extensions: [".ts", ".js"],
    alias: {
      preact: path.resolve(__dirname, 'node_modules', 'preact'),
      'preact/hooks': path.resolve(__dirname, 'node_modules', 'preact', 'hooks'),
    }
  },

To your webpack.config.js does not only reduce bundle size it also removes the error, note that a setup like this would fail with any framework.

0reactions
maltiumcommented, Oct 11, 2019

@developit I checked an there definitely are no copies of Preact 8 in node_modules.

I’ve created a repo that reproduces the issue https://github.com/maltium/repro-preact-hook

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new in Preact X
New features and changes in Preact X. ... This can be used to display user-friendly error messages, or write a log entry to...
Read more >
TypeScript | Preact: Fast 3kb React alternative with the same ...
Preact's Component class is typed as a generic with two generic type variables: Props and State. Both types default to the empty object,...
Read more >
Debugging Preact Apps
Preact will throw this error whenever you pass undefined instead of a component. The common cause for this one is mixing up default...
Read more >
Upgrading from Preact 8.x
This document is intended to guide you through upgrading an existing Preact 8.x application to Preact X and is divided in 3 main...
Read more >
Differences to React - Preact
x when discussing compatibility or making comparisons. Debug messages and errors. Our flexible architecture allows addons to enhance the Preact experience in ...
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