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

[[email protected]] unexpected js error with deno 2.0.1+ with wrong chunks order #26616

Open
mindon opened this issue Oct 29, 2024 · 4 comments
Labels
important for fresh needs info needs further information to be properly triaged needs investigation requires further investigation before determining if it is an issue or not

Comments

@mindon
Copy link

mindon commented Oct 29, 2024

Version: Deno 2.0.1+

denoland/fresh#2714

jsr:@fresh/[email protected] works fine with Deno 2.0.0, but not 2.0.1+ with an js error

image
@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Oct 29, 2024

That error always occurs when there are multiple instances of Preact being used at the same time. They don't know about each other. Running deno info main.ts might reveal where the other copy of Preact is getting pulled in.

@mindon
Copy link
Author

mindon commented Oct 30, 2024

That error always occurs when there are multiple instances of Preact being used at the same time. They don't know about each other. Running deno info main.ts might reveal where the other copy of Preact is getting pulled in.

thanks.

jsr:@preact-icons/tb deps @preact-icons/common deps npm:preact@^10.22.1,
while others such as @preact/[email protected] deps @preact/10.24.3

one more question is that the deno 2.0.0 works, and 2.0.1+ not, so i thought this would be a deno issue

multiple versions of deps is very common situation, it matters.

@bartlomieju
Copy link
Member

@mindon is there a repo that you could share so we can try this case?

@bartlomieju bartlomieju added needs info needs further information to be properly triaged needs investigation requires further investigation before determining if it is an issue or not important for fresh labels Oct 31, 2024
@mindon
Copy link
Author

mindon commented Nov 1, 2024

it seems the issue comes from chunks import orders of preact-signals, NOT the multiple versions of Preact.

when i use a simple demo project with following islands/Counter.tsx there's only one chunk generated, everything is fine.
the Symbol.for("preact-signals") is found in the middle of the only chunk js imported by Counter.js

but if i using the same Counter.tsx in my real project, Counter.js imports 4 chunk js, and Symbol.for("preact-signals") is the very beginning of the first chunk js, the js error happened! (Deno 2.0.1+), under Deno 2.0.0 there're 2 chunk js before the Symbol.for("preact-signals").

@bartlomieju here's how the output diff build with Deno 2.0.0 and 2.0.4
Counter_js-Deno_v2.0.0-vs-v2.0.4.zip

import { useSignal } from "@preact/signals";

export default function Counter() {
  const s = useSignal(1);
  return (
    <>
      <div>{ s.value }</div>
    </>
  );
}

@mindon mindon changed the title [[email protected]] unexpected js error with deno 2.0.1+ [[email protected]] unexpected js error with deno 2.0.1+ with wrong chunks order Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important for fresh needs info needs further information to be properly triaged needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

No branches or pull requests

3 participants