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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// There is a bug in Rollup that non-deterministically fails to detect cyclic
// dependencies. https://github.com/rollup/plugins/issues/1425
// As a result 'lru-cache' is sometimes wrapped in a require* 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, 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.
// TODO: Remove when the Rollup issue is fixed.
import "lru-cache";
dskloetd marked this conversation as resolved.
Show resolved Hide resolved

export const prerender = true;

// TODO: no ssr for local development until https://github.com/dfinity/ic-js/issues/238 solved
Expand Down