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

Potential work-around for Rollup cyclic dependency bug #2332

Merged
merged 3 commits into from Apr 19, 2023
Merged

Conversation

dskloetd
Copy link
Contributor

Motivation

There is a bug in Rollup that non-deterministically fails to detect cyclic
dependencies. rollup/plugins#1425
As a result lru-cache is sometimes wrapped in a requireLruCache function and sometimes it is not.
This makes our build non-deterministic.
lru-caceh is not itself part of a circular dependency but semver/classes/range.js, which depends on lru-cache, is.
By depending on lru-cache directly from our app, we change the order in which modules are analyzed by Rollup, hopefully avoiding the buggy behavior.
It probably doesn't matter where we put this import, so I put it as close to the root of the app as I could find.

Changes

Add import "lru-cache" in frontend/src/routes/+layout.ts

Tests

Inspected generated vendor chunk to see that it does not have hasRequiredLruCache.
dfx deploy nns-dapp locally and did some manual testing.

@dskloetd dskloetd marked this pull request as ready for review April 18, 2023 14:47
Copy link
Member

@peterpeterparker peterpeterparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, well spotted!

Copy link
Contributor

@lmuntaner lmuntaner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! 🤞

@dskloetd dskloetd enabled auto-merge April 19, 2023 06:33
@dskloetd dskloetd added this pull request to the merge queue Apr 19, 2023
Merged via the queue into main with commit 51e4e1f Apr 19, 2023
27 of 29 checks passed
@dskloetd dskloetd deleted the kloet/yallist branch April 19, 2023 07:51
bitdivine added a commit that referenced this pull request Apr 19, 2023
# Motivation
When cleaning up the commit comparison tool I managed to delete the line
where the local code is checked out.

# Changes
- Check out the commit being tested before running the local docker
build.

# Tests
Running on a range of commits shows the repo being checked out:
```
$ ./scripts/nns-dapp/frontend-reproducibility-report
Previous HEAD position was 027bd72 E2E: Stake an SNS neuron (#2316)
HEAD is now at c01f191 Better command line url test (#2324)
Previous HEAD position was c01f191 Better command line url test (#2324)
HEAD is now at 38e3a55 fix: broken gap by tid (#2337)
Previous HEAD position was 38e3a55 fix: broken gap by tid (#2337)
HEAD is now at 388abdd Log pre-upgrade cycle count (#2335)
Previous HEAD position was 388abdd Log pre-upgrade cycle count (#2335)
HEAD is now at 2de7376 Style improvement for release candidate (#2334)
Previous HEAD position was 2de7376 Style improvement for release candidate (#2334)
HEAD is now at 51e4e1f Potential work-around for Rollup cyclic dependency bug (#2332)
```

Co-authored-by: Max Murphy-Skvorzov <max@winning.black>
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.

None yet

3 participants