polkawallet-io / sdk

polkawallet SDK for integrating substrate-based blockchain as a plugin.
Apache License 2.0
18 stars 24 forks source link

Webpack build does not work #39

Open L3odr0id opened 11 months ago

L3odr0id commented 11 months ago

Describe the bug Hi! I'm working on the polkawallet-compatible app. I need to provide types in js_api/src/index.ts. But I can't build webpack to use the code. But I get this error:

assets by status 10.4 MiB [cached] 2 assets
orphan modules 4.48 MiB [orphan] 1030 modules
runtime modules 2.56 KiB 14 modules
modules by path ./node_modules/ 14.3 MiB 3067 modules
optional modules 120 bytes [optional]
  buffer (ignored) 15 bytes [optional] [built] [code generated]
  buffer (ignored) 15 bytes [optional] [built] [code generated]
  buffer (ignored) 15 bytes [optional] [built] [code generated]
  + 5 modules
modules by path ./src/*.ts 2.45 MiB
  ./src/index.ts + 970 modules 2.43 MiB [built] [code generated]
  ./src/bridge.ts + 3 modules 20.3 KiB [built] [code generated]
+ 6 modules

ERROR in ./node_modules/@acala-network/sdk/wallet/balance-adapter/erc20-adapter.js 8:13-62
Module not found: Error: Can't resolve '@acala-network/eth-providers/lib/utils' in '/workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/wallet/balance-adapter'
resolve '@acala-network/eth-providers/lib/utils' in '/workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/wallet/balance-adapter'
  Parsed request is a module
  using description file: /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/package.json (relative path: ./wallet/balance-adapter)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/wallet/balance-adapter/node_modules doesn't exist or is not a directory
      /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/wallet/node_modules doesn't exist or is not a directory
      looking for modules in /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/node_modules
        /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/sdk/node_modules/@acala-network/eth-providers doesn't exist
      /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/node_modules doesn't exist or is not a directory
      /workspaces/polkawallet_sdk/js_api/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /workspaces/polkawallet_sdk/js_api/node_modules
        existing directory /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers
          using description file: /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/package.json (relative path: .)
            using exports field: ./lib/lib/utils.js
              using description file: /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/package.json (relative path: ./lib/lib/utils.js)
                no extension
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js doesn't exist
                .ts
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js.ts doesn't exist
                .js
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js.js doesn't exist
                .mjs
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js.mjs doesn't exist
                .cjs
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js.cjs doesn't exist
                .json
                  Field 'browser' doesn't contain a valid alias configuration
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js.json doesn't exist
                as directory
                  /workspaces/polkawallet_sdk/js_api/node_modules/@acala-network/eth-providers/lib/lib/utils.js doesn't exist
      /workspaces/polkawallet_sdk/node_modules doesn't exist or is not a directory
      /workspaces/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./node_modules/@acala-network/sdk/wallet/balance-adapter/acala.js 12:20-46
 @ ./node_modules/@acala-network/sdk/wallet/wallet.js 24:13-47
 @ ./node_modules/@acala-network/sdk/wallet/index.js 5:14-33
 @ ./src/service/bridge.ts 34:0-51 91:25-31
 @ ./src/bridge.ts 2:0-38 13:16-22

ERROR in ./src/service/walletconnect/v2/client.ts 20:0-54
Module not found: Error: Can't resolve '../../../config.local' in '/workspaces/polkawallet_sdk/js_api/src/service/walletconnect/v2'
resolve '../../../config.local' in '/workspaces/polkawallet_sdk/js_api/src/service/walletconnect/v2'
  using description file: /workspaces/polkawallet_sdk/js_api/package.json (relative path: ./src/service/walletconnect/v2)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /workspaces/polkawallet_sdk/js_api/package.json (relative path: ./src/config.local)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local.js doesn't exist
      .mjs
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local.mjs doesn't exist
      .cjs
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local.cjs doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /workspaces/polkawallet_sdk/js_api/src/config.local.json doesn't exist
      as directory
        /workspaces/polkawallet_sdk/js_api/src/config.local doesn't exist
 @ ./src/service/walletconnect/index.ts 4:0-34 6:16-23
 @ ./src/index.ts 14:0-41 127:23-25

webpack 5.88.2 compiled with 2 errors in 98232 ms

To Reproduce Execute these lines: npm install yarn install yarn run build

Expected behavior I was building 0.5.1 version without problems. But 0.5.4 throws the error.

It seems, there is no @acala-network and some config.local is missing.