Skip to content

fix: avoid webpack path resolution interfering with vecLib import #1030

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

Merged
merged 1 commit into from
Apr 21, 2025

Conversation

nborges-aws
Copy link
Contributor

Problem

Webpack is trying to handle the dynamic import for the vector libary using its own module resolution system. This causes the library to fail at runtime.

Solution

Import the library using eval, which webpack will ignore and leave the path resolution unchanged.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@nborges-aws nborges-aws requested a review from a team as a code owner April 21, 2025 19:57
@@ -131,7 +131,7 @@ export class LocalProjectContextController {
)

const libraryPath = path.join(LIBRARY_DIR, 'dist', 'extension.js')
const vecLib = vectorLib ?? (await import(libraryPath))
const vecLib = vectorLib ?? (await eval(`import("${libraryPath}")`))
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't eval carry a bit of risk? But I can merge to unblock the bug bash

@jpinkney-aws jpinkney-aws merged commit 6e6c229 into main Apr 21, 2025
6 checks passed
@jpinkney-aws jpinkney-aws deleted the nickdb/vecLibPathResolutionFix branch April 21, 2025 20:08
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