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

Web component is not bundled, unless wrapped #43068

Open
1 task done
cyberalien opened this issue Nov 18, 2022 · 0 comments
Open
1 task done

Web component is not bundled, unless wrapped #43068

cyberalien opened this issue Nov 18, 2022 · 0 comments
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template.

Comments

@cyberalien
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
Binaries:
Node: 18.12.1
npm: 9.1.2
Yarn: 1.22.19
pnpm: 7.13.4
Relevant packages:
next: 13.0.4-canary.5
eslint-config-next: 13.0.3
react: 18.2.0
react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

next dev

Describe the Bug

Web component is not bundled, unless wrapped in client only component.

When using web component as is, it fails to render because bundle served to browser does not include web component.

Failing component example:

import { Icon } from "@iconify-icon/react";

export default function Index() {
  return (
    <div className="error">
      <Icon icon="ic:round-home" width={96} height={96} />
    </div>
  );
}

However, when wrapped in client only component, it works:

import IconWrapper from "@/components/IconWrapper";

export default function Index() {
  return (
    <div className="success">
      <IconWrapper icon="ic:round-home" width={96} height={96}  />
    </div>
  )
}

and wrapper:

"use client";
import { Icon } from "@iconify-icon/react";

export default Icon;

Those examples are almost identical, but one works, one doesn't.

Expected Behavior

Expected web component code to be included in bundle.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/cyberalien/iconify-next13-bug

To Reproduce

  1. Install and run next dev.
  2. Visit http://localhost:3000/error, see empty page. It supposed to render icon.
  3. Visit http://localhost:3000/success, see correct page.

If you do see icon when visiting /error route, refresh page in browser to see empty page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants