-
Notifications
You must be signed in to change notification settings - Fork 557
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 externalize bug #4984
fix externalize bug #4984
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Looker3d"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import * as foa from "@fiftyone/aggregations"; | ||
import * as focore from "@fiftyone/core"; | ||
import * as foe from "@fiftyone/embeddings"; | ||
import * as foc from "@fiftyone/components"; | ||
import * as fof from "@fiftyone/flashlight"; | ||
import * as fol from "@fiftyone/looker"; | ||
import * as fom from "@fiftyone/map"; | ||
import * as foo from "@fiftyone/operators"; | ||
import * as fopb from "@fiftyone/playback"; | ||
import * as fop from "@fiftyone/plugins"; | ||
import * as fosp from "@fiftyone/spaces"; | ||
import * as fosl from "@fiftyone/spotlight"; | ||
import * as fof from "@fiftyone/flashlight"; | ||
import * as fol3d from "@fiftyone/looker-3d"; | ||
import * as foc from "@fiftyone/components"; | ||
import * as foo from "@fiftyone/operators"; | ||
import * as fos from "@fiftyone/state"; | ||
import * as fou from "@fiftyone/utilities"; | ||
import * as fosp from "@fiftyone/spaces"; | ||
import * as fop from "@fiftyone/plugins"; | ||
import * as mui from "@mui/material"; | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
|
@@ -31,16 +27,18 @@ declare global { | |
__fosp__: typeof fosp; | ||
__fop__: typeof fop; | ||
__foa__: typeof foa; | ||
__focore__: typeof focore; | ||
__foe__: typeof foe; | ||
__fol__: typeof fol; | ||
__fom__: typeof fom; | ||
__fopb__: typeof fopb; | ||
__fosl__: typeof fosl; | ||
__fof__: typeof fof; | ||
__fol3d__: typeof fol3d; | ||
__mui__: typeof mui; | ||
__styled__: typeof styled; | ||
|
||
// todo: the following cannot be externalized because of unknown reason | ||
// __focore__: typeof focore; | ||
// __fol3d__: typeof fol3d; | ||
// __fom__: typeof fom; | ||
// __foe__: typeof foe; | ||
} | ||
} | ||
|
||
|
@@ -58,13 +56,14 @@ if (typeof window !== "undefined") { | |
window.__mui__ = mui; | ||
window.__fop__ = fop; | ||
window.__foa__ = foa; | ||
window.__focore__ = focore; | ||
window.__foe__ = foe; | ||
window.__fol__ = fol; | ||
window.__fom__ = fom; | ||
window.__fopb__ = fopb; | ||
window.__fosl__ = fosl; | ||
window.__fof__ = fof; | ||
window.__fol3d__ = fol3d; | ||
window.__styled__ = styled; | ||
// todo: the following cannot be externalized because of unknown reason | ||
// window.__fol3d__ = fol3d; | ||
// window.__foe__ = foe; | ||
// window.__fom__ = fom; | ||
// window.__focore__ = focore; | ||
Comment on lines
+64
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding runtime checks for externalized dependencies. Since some modules cannot be externalized, consider adding runtime checks to gracefully handle cases where plugins might attempt to access these unavailable modules. Add defensive checks: if (typeof window !== "undefined") {
+ const warnUnavailable = (module: string) => {
+ console.warn(`${module} is not available as an external dependency`);
+ };
+
// existing assignments...
- // window.__fol3d__ = fol3d;
+ Object.defineProperty(window, '__fol3d__', {
+ get() {
+ warnUnavailable('looker-3d');
+ return undefined;
+ }
+ });
// Similar pattern for other unavailable modules
}
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Based on the analysis of the import patterns and dependencies, I can now provide a final response:
Externalization blockers likely due to internal package dependencies
The investigation reveals that these modules cannot be externalized due to complex interdependencies within the codebase:
@fiftyone/core
is heavily imported across multiple packages and contains shared components@fiftyone/looker-3d
has bidirectional dependencies with core (e.g., core imports Looker3d component while looker-3d imports core components)@fiftyone/core/src/plugins/SchemaIO/components/ButtonView
)These patterns suggest that externalization would require significant refactoring to:
🔗 Analysis chain
Investigate root cause of externalization failures.
The TODO comments indicate systematic issues with specific modules (
focore
,fol3d
,fom
,foe
). This could be related to circular dependencies or module resolution problems.Let's check for potential circular dependencies:
Let me gather more specific information about the imports and dependencies between these modules.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1169
Script:
Length of output: 5409