TypeChat icon indicating copy to clipboard operation
TypeChat copied to clipboard

typechat does not take effect in vscode extension

Open 7neves opened this issue 1 year ago • 2 comments

There is no problem using typechat during the development process, but after packaging it through vsce package, it does not take effect.

7neves avatar Jun 13 '24 07:06 7neves

When I use

import { createTypeScriptJsonValidator } from "typechat/ts"

When imported, it will become

const ts1 = require('typechat/ts');

As a result, the package cannot be imported I manually modified the directory structure of typechat in node_moudles, moved the validate.js file in the typechat/dist/ts directory to the typechat/dist directory, and then used import { createTypeScriptJsonValidator } from "typechat" The problem is solved. Is there a problem with the configuration of tsconfig? Or is there something wrong somewhere else?

7neves avatar Jun 13 '24 09:06 7neves

I'm not exactly sure what is going wrong (I'm not seeing what error you're hitting) - however, if you are using typechat/ts, my guess is that you need to find a way to bring the original source text of your .ts schema around as an asset. Depending on your bundler, there are different ways to achieve this. In many bundlers (like Vite), you can add ?raw to the path to import the contents as a string.

import schema from './schema.ts?raw';

DanielRosenwasser avatar Jun 18 '24 19:06 DanielRosenwasser