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

No loader is configured for ".wasm" files #1276

Closed
logancyang opened this issue May 16, 2023 · 2 comments
Closed

No loader is configured for ".wasm" files #1276

logancyang opened this issue May 16, 2023 · 2 comments

Comments

@logancyang
Copy link

Hi, I'm trying to use langchainJS in an Obsidian plugin, and the plugin system uses esbuild. Seeing this error after I added langchain to my plugin

> node esbuild.config.mjs

[watch] build finished, watching for changes...
✘ [ERROR] No loader is configured for ".wasm" files: node_modules/@dqbd/tiktoken/tiktoken_bg.wasm

    node_modules/@dqbd/tiktoken/tiktoken.js:1:22:
      1 │ import * as wasm from "./tiktoken_bg.wasm";

I'm quite new to all this, not sure what issues need to be solved in order for me to proceed. Here's what I tried: I installed https://github.com/Tschrock/esbuild-plugin-wasm but it introduced a new error where it complains about top-level awaits. This esbuild-plugin-wasm readme actually has the note that says

This loader makes use of top-level await, which only has partial support in esbuild. For now, it is only supported with the esm output format, not the iife or cjs formats. See evanw/esbuild#253

I checked that esbuild issue there, but it was still open from 2020, seems not going to change anytime soon.

Can someone please kindly help me understand what needs to be done in order for me to use langchainjs in my Obsidian plugin? Switching the bundler from esbuild to something else probably isn't an option for me.

I saw this issue #1239, but not sure if this solves my problem.

@Tangjj1996
Copy link

I met the same problem, and I used esbuild WebAssembly plugin to solve this. Maybe you can try.
https://esbuild.github.io/plugins/#webassembly-plugin

@logancyang
Copy link
Author

@Tangjj1996 Thank you so much! This worked for me! Closing this one now.

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

No branches or pull requests

2 participants