WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.92k stars 1.34k forks source link

[BUG] SyntaxError: The requested module '@whiskeysockets/baileys' does not provide an export named 'proto' #291

Closed olalonde closed 1 year ago

olalonde commented 1 year ago

Describe the bug

SyntaxError: The requested module '@whiskeysockets/baileys' does not provide an export named 'proto'

To Reproduce

npm install @whiskeysockets/baileys

import { proto } from "@whiskeysockets/baileys";
tsc

Expected behavior No error.

Environment (please complete the following information): MacOS, typescript

Additional context

Trying to run the code in https://github.com/WhiskeySockets/Baileys/blob/master/Example/example.ts from a separate package.

andresayac commented 1 year ago

Describe the bug

SyntaxError: The requested module '@whiskeysockets/baileys' does not provide an export named 'proto'

To Reproduce

npm install @whiskeysockets/baileys

import { proto } from "@whiskeysockets/baileys";
tsc

Expected behavior No error.

Environment (please complete the following information): MacOS, typescript

Additional context

Trying to run the code in https://github.com/WhiskeySockets/Baileys/blob/master/Example/example.ts from a separate package.

use this please don't forget to mark as solved

import makeWASocket, {  proto } from '@whiskeysockets/baileys'
olalonde commented 1 year ago

This does not solve the issue.

tsx src/bin/bot.ts

/Users/redacted/code/myapp/src/bot/index.ts:9
import makeWASocket, { proto } from "@whiskeysockets/baileys";
                       ^

SyntaxError: The requested module '@whiskeysockets/baileys' does not provide an export named 'proto'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)
    at async CustomizedModuleLoader.import (node:internal/modules/esm/loader:228:24)
    at async loadESM (node:internal/process/esm_loader:40:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.5.0
olalonde commented 1 year ago

This seems to work

import {
  WAProto as proto,
} from "@whiskeysockets/baileys";