Error in bundling due to a npm library (failed to resolve only because it was resolved as fully specified)

I am trying to run forge tunnel but the bundling fails due to an external library I am using.

The code which is causing the issue,

import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";

The error message is,

Error: Bundling failed: Module not found: Error: Can't resolve 'js-tiktoken/lite' in '/app/node_modules/langchain/dist/util'
Did you mean 'lite.js'?
BREAKING CHANGE: The request 'js-tiktoken/lite' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Is there a way I can make modifications to the bundler that is behind the forge cli or use a custom bundler of my own?

Any help or insights would be really helpful.


Hi @indrapranesh,

Sorry, we currently don’t support the custom bundler feature.
However, your interest aligns with ongoing discussions on our platform. We have a ticket open for this feature on our board, which is currently gathering recognition and support. To help prioritize this feature, please cast your vote for this ticket.


Hi @JingYuan ,

Thanks for the response.
I am trying to use the langchain library in my app, which is throwing the error. I am currently working on an app for the Atlassian Codegeist for which the submission is due in about a week. This error has been a blocker for a couple of days.
Is there any way that you know of could bypass this error ?


Hi @indrapranesh,

Maybe you can try bundling the package somewhere else using your own bundle tool, and copy the result to src/index.js.

I’d also suggest you give a try to our new node runtime(EAP), it might have less problem with using npm packages.