Skip to content

Async routes cause warning when using preact/debug #456

@jgierer12

Description

@jgierer12

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When using preact/debug as recommmended in the Preact readme, async routes cause the following warning to appear in the browser console:

Undefined component passed to preact.h()
<undefined path="/" url="/" matches="[object Object]" /> debug.js:17

The routes still work perfectly fine, but the warning is misleading and confusing.

I'm not sure if this is a bug in preact-cli's async loading strategy or preact itself, but I suspect the former.

If the current behavior is a bug, please provide the steps to reproduce.

  1. preact create default test
  2. cd test, npm install
  3. Edit src/components/app.js as follows:
 import { Router } from 'preact-router';
 
+if (module.hot) {
+	require('preact/debug');
+}
+
 import Header from './header';
  1. npm run start, open http://localhost:8080, open console with Ctrl+Shift+K (or your OS and browser's equivalent)
  2. The above warning will appear in the console

What is the expected behavior?
No warning should be shown since everything works as expected

Please mention other relevant information.

  • node version 8.9.1
  • npm version 5.6.0
  • Operating system Windows 10 1709

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions