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

typechat does not take effect in vscode extension #251

Open
7neves opened this issue Jun 13, 2024 · 2 comments
Open

typechat does not take effect in vscode extension #251

7neves opened this issue Jun 13, 2024 · 2 comments
Labels
Needs More Info More information is necessary before further actions are taken. Question Further information is requested

Comments

@7neves
Copy link

7neves commented Jun 13, 2024

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

@7neves
Copy link
Author

7neves commented Jun 13, 2024

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?

@DanielRosenwasser
Copy link
Member

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 DanielRosenwasser added Question Further information is requested Needs More Info More information is necessary before further actions are taken. labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info More information is necessary before further actions are taken. Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants