chatgpt-vscode icon indicating copy to clipboard operation
chatgpt-vscode copied to clipboard

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

Open manestream opened this issue 1 year ago • 8 comments

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!

manestream avatar Dec 04 '22 21:12 manestream

Having the same issue

andreseichi avatar Dec 04 '22 21:12 andreseichi

Same Issue here

ashhama avatar Dec 04 '22 21:12 ashhama

Same issue

toledojorge avatar Dec 04 '22 22:12 toledojorge

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

pistachiomatt avatar Dec 05 '22 00:12 pistachiomatt

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

abi avatar Dec 05 '22 04:12 abi

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

abi avatar Dec 05 '22 05:12 abi

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.

ghost avatar Dec 05 '22 13:12 ghost

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

timkmecl avatar Dec 06 '22 18:12 timkmecl