electron / electron/forge

Unable to use tdl package with vite

Open
#3,974 2 comments 0 reactions 0 assignees View on GitHub
native-modules plugin/vite
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Forge version

7.8.3

### Electron version

37.2.6

### Operating system

Windows 10

### Last known working Forge version

_No response_

### Expected behavior

I can use it.

### Actual behavior

An error occurred
```
Error: No native build was found for platform=win32 arch=x64 runtime=electron abi=136 uv=1 libc=glibc node=22.17.1 electron=37.2.6
loaded from: D:\CodeSpace\eeeeeee\my-new-vtt\.vite

at load.resolve.load.path (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2145:11)
at load (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2113:33)
at loadAddon (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2316:47)
at init (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2437:41)
at createAnyClient (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2505:7)
at Object.createClient (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2535:12)
at App.createWindow (D:\CodeSpace\eeeeeee\my-new-vtt\.vite\build\main.js:2754:7)
at App.emit (node:events:518:28)
```

### Steps to reproduce

use `npx create-electron-app@latest my-new-app --template=vite-typescript` to create project
use `npm install tdl prebuilt-tdlib`
```ts
import tdl from "tdl";
import { getTdjson } from "prebuilt-tdlib";
tdl.configure({ tdjson: getTdjson() });
const client = tdl.createClient({
apiId: 0,
apiHash: "...",
});
```
`npm run start`

### Additional information

When I don't use vite, it worke. (use `npx create-electron-app@latest my-app`)

I found that, `tdl` use `node-gyp-build` to load `.node` file

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.