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

fix: createSignal not found when bundled #1964

Merged
merged 3 commits into from
Dec 1, 2023
Merged

Conversation

CrabNejonas
Copy link
Contributor

@CrabNejonas CrabNejonas commented Nov 23, 2023

In some circumstances a global function export (like createSignal) can be transformed by rollup into a let binding, which will break the global evaluation of transPending since then createSignal will be defined after being used.
I.e. the code from signal.ts which looks like this:

const [transPending, setTransPending] = createSignal(false);

// ... some other code

export function createSignal(){}

will be translated to

let createSignal;

const [transPending, setTransPending] = createSignal(false);

export function createSignal(){}

which obviously won't work anymore since the let definition isn't hoisted.

While I believe this bug should fundamentally be solved in rollup itself this is a quick, rather painless fix (it's interesting that rollup isn't smart enough to reason about in-file dependencies in this way)

How did you test this change?

The app that this came up in is still closed-source unfortunately, and this bug - being a codegen-bug - proofed itself to be hard to reproduce, but I hope the above reasoning is easy enough to follow.

In some circumstances a global function export (like `createSignal`) can be transformed by rollup into a let binding, which will break the global evaluation of `transPending` since then `createSignal` will be defined after being used.
Copy link

changeset-bot bot commented Nov 23, 2023

🦋 Changeset detected

Latest commit: d309935

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
solid-js Patch
test-integration Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ryansolid ryansolid merged commit 22667bb into solidjs:main Dec 1, 2023
1 check passed
@ryansolid
Copy link
Member

Thank you

@coveralls
Copy link

coveralls commented Jan 27, 2024

Pull Request Test Coverage Report for Build 7064336723

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.486%

Totals Coverage Status
Change from base Build 6963643110: 0.0%
Covered Lines: 4148
Relevant Lines: 4368

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

3 participants