#Bun on vscode import error but code working

1 messages · Page 1 of 1 (latest)

thick pike
#

My first time using a Bun coming from using Node, I use VSCode as my IDE, and everything works correctly, the only issue I have is that when I do an import, I get the message: "The module 'xxx' is not found. Did you intend to set the 'moduleResolution' option to 'node' or add aliases to the 'paths' option?". As said, if i do bun run on the file, it works fine, but i cant see methods and autocompletion, and the error kinda anoys me. Any clue?

index.ts:


const app = new Elysia()
    .get('/', () => 'Hello Elysia')
    .listen(8080)


console.log(`🦊 Elysia is running at on port ${app.server.port}...`)````

tsconfig.json:
```{
  "compilerOptions": {
    "lib": ["ESNext"],
    "module": "esnext",
    "target": "esnext",
    "moduleResolution": "bundler",
    "moduleDetection": "force",
    "allowImportingTsExtensions": true,
    "noEmit": true,
    "composite": true,
    "strict": true,
    "downlevelIteration": true,
    "skipLibCheck": true,
    "jsx": "preserve",
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "allowJs": true,
    "types": [
      "bun-types" // add Bun global
    ]
  }
}
trail berry
thick pike
#

Good to hear i'm not the only one xD

#

But kinda weird couse bun run works, is just like compiler warning or idk...

terse vale
#

Did you install the extension ?