How to solve the js-sdk load error?

Who have encountered this problem?

 * WARNING in ./src/lib/api.js
 * 6:2-4 "export 'Ae' was not found in '@Albert/aepp-sdk/es/ae/universal'
 *  @ ./src/lib/api.js

in api.js just use this:
import { Ae } from '@Albert/aepp-sdk/es/ae/universal'

error:
ERROR in ./node_modules/@Albert/aepp-sdk/es/tx/tx.js

Module parse failed: Unexpected token (39:84)

You may need an appropriate loader to handle this file type.

| async function spendTx ({ senderId, recipientId, amount, payload = '' }) {

| // Calculate fee, get absolute ttl (ttl + height), get account nonce

| const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.spend, { senderId, ...R.head(arguments), payload })

| 

| // Build transaction using sdk (if nativeMode) or build on `AETERNITY NODE` side

 @ ./node_modules/@Albert/aepp-sdk/es/ae/universal.js 29:0-35

 @ ./src/lib/api2.js

 @ ./src/popup/mixins/account.js

When use import Ae from '@Albert/aepp-sdk/es/ae/universal' , it will got similar error in :
ERROR in ./node_modules/@Albert/aepp-sdk/es/ae/aens.js
ERROR in ./node_modules/@Albert/aepp-sdk/es/tx/tx.js

Thank you very much!

Hey, please try to import things like
import { Universal } from '@aeternity/aepp-sdk' (import from bundle ./node_modules/@aeternity/aepp-sdk/dist)
if you want to import staff using full path to file(tree-shaking) you need to configure your web-pack to transpile sdk before.

1 Like

Thank you very much!

1 Like