mpociot / chatgpt-vscode

A VSCode extension that allows you to use ChatGPT
4.99k stars 365 forks source link

Module not found: Error: Default condition should be last one #1

Open manestream opened 1 year ago

manestream commented 1 year ago

Hey Marcel,

first of all, thanks a lot for this repo and your idea. This is really awesome.

I cloned your repository and tried to set it up locally but somehow webpack is not able to resolve the chatgpt module, albeit it has been installed and can be found by vscode and within the node_modules.

Steps to reproduce:

  1. Clone the repository
  2. cd to folder
  3. yarn install
  4. Start vscode from that folder
  5. Press f5 for a debugging session

I see the extension in the tab in the Extension Development Ide, but when i click i get the error in the logs:

Module not found: Error: Default condition should be last one

i get the same error when i try to compile with yarn compile

Versions: macos: 12.5.1 vscode: Version: 1.73.1, Commit: 6261075646f055b99068d3688932416f2346dd3b yarn: 1.22.11 node: v16.13.2

thanks a lot in advance!

andreseichi commented 1 year ago

Having the same issue

ashhama commented 1 year ago

Same Issue here

georgewashtol commented 1 year ago

Same issue

pistachiomatt commented 1 year ago

Have the same issue. I think the issue is the compiled code is generating unreachable code but I haven't looked deeper into it.

abi commented 1 year ago

The source of the issue is the https://github.com/transitive-bullshit/chatgpt-api repo. I haven't found a solution yet.

abi commented 1 year ago

I built the chatgpt-api repo separately, then inlined it into this repo and everything works. So, still not sure what the root cause is but at least it works now.

For anyone who wants to just run it, checkout https://github.com/abi/chatgpt-vscode/commits/main

ghost commented 1 year ago

In order to make it work, I modified the exports property of node_modules\chatgpt\package.json, like this (I moved the default property to be the last one in the object): "exports": { "import": "./build/index.js", "types": "./build/index.d.ts", "default": "./build/index.js" },

After that, I was able to run vsce package successfully.

timkmecl commented 1 year ago

They solved this in v1.2.2 of the chatgpt-api. However, v1.0.0 introduces some breaking changes so the code of this repo doesn't work anymore