Skip to content

Unable to use tdl package with vite #3974

@qiaoshouzi

Description

@qiaoshouzi

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • 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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions