MinterTeam / minterjs-wallet

Lightweight Minter Wallet implementation.
https://minter.network
MIT License
8 stars 5 forks source link

Can't attach module #3

Open abrikos opened 5 years ago

abrikos commented 5 years ago

My minter.js: import {generateWallet} from 'minterjs-wallet'; const wallet = generateWallet(); Run

nodejs --experimental-modules minter.mjs

Result: SyntaxError: The requested module 'minterjs-wallet' does not provide an export named 'generateWallet' at ModuleJob._instantiate (internal/modules/esm/module_job.js:80:21)

Run

babel-node minter.mjs --presets es2015,stage-2

Result: (function (exports, require, module, filename, dirname) { import bip39 from 'bip39'; ^^^^^ (bip39)

SyntaxError: Unexpected identifier at new Script (vm.js:79:7)

There is right way to run that?

shrpne commented 5 years ago

Sorry for late response. I think --experimental-modules will not work, as minterjs files don't have .mjs extension.

Babel approach fails, because it doesn't transpile minterjs-utils from node_modules This command should make it work:

babel-node --ignore '/node_modules/(?!minterjs-util)' --presets env index.js

Also minterjs-wallet@3.0.0 released and it has commonjs build which should work with node.js without additional configuration