VanishMax / foton

⚡ Create TON dApps with the speed of a foton
https://foton.sh
MIT License
31 stars 2 forks source link

TypeError: (0 , S.default) is not a function #2

Open Nizarius opened 2 months ago

Nizarius commented 2 months ago

I receive this stack trace when trying to invoke createPublicClient in nodejs environment:

TypeError: (0 , S.default) is not a function
    at G (/Users/petrpotapov/Projects/lottery-smart-func/smart-func/node_modules/@fotonjs/api/dist/index.cjs:1:2864)
    at $ (/Users/petrpotapov/Projects/lottery-smart-func/smart-func/node_modules/@fotonjs/core/dist/index.cjs:1:1207)
    at Object.<anonymous> (/Users/petrpotapov/Projects/lottery-smart-func/smart-func/scripts/getLotteryResults.ts:16:47)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module.m._compile (/Users/petrpotapov/Projects/lottery-smart-func/smart-func/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/petrpotapov/Projects/lottery-smart-func/smart-func/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)

Environment: "@fotonjs/core": "^0.0.7", "@ton/core": "^0.56.3",

TS config (tested in different environments, didn't help): { "compilerOptions": { "target": "ES2020", "outDir": "dist", "module": "commonjs", "declaration": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true } }

My current ideation process is that this library is designed to be used in browser environment with nodejs polyfills and isn't designed to be used on the backend. Is that correct assumption?

VanishMax commented 2 months ago

@Nizarius Thanks for the issue. Foton wasn't tested within node environment yet, but the idea is that it should work as expected in both Node and Browser. Only createWalletClientUI is designed to be browser-only