aelf-web3.js recently underwent a dependency upgrade, which included upgrading from Webpack 4 to Webpack 5. This upgrade has introduced some issues due to Webpack's removal of built-in polyfills, requiring users to manually include necessary packages. As a result, the bundled output frequently throws errors related to missing process or similar variables. Additionally, there's a problem with the bundled output for Node.js environments using CommonJS: the external import statement const { AElf } = require('aelf-sdk') is generated, while the desired import is const AElf = require('aelf-sdk').
Steps To Reproduce
Ensure that the project includes dependencies that rely on process or other Node.js built-in modules.
Import the bundled file in a Node.js environment using const AElf = require('aelf-sdk').
The Current Behavior
The bundled output throws errors indicating that process or other built-in Node.js modules are missing.
The CommonJS module export in the bundled file results in the import statement const { AElf } = require('aelf-sdk'), which is not the intended usage.
The Expected Behavior
The bundled output should include necessary polyfills or configuration to avoid errors related to missing process or other built-in Node.js modules.
The CommonJS module export should result in the import statement const AElf = require('aelf-web3.js') to ensure correct usage in a Node.js environment.
Description
aelf-web3.js recently underwent a dependency upgrade, which included upgrading from Webpack 4 to Webpack 5. This upgrade has introduced some issues due to Webpack's removal of built-in polyfills, requiring users to manually include necessary packages. As a result, the bundled output frequently throws errors related to missing process or similar variables. Additionally, there's a problem with the bundled output for Node.js environments using CommonJS: the external import statement
const { AElf } = require('aelf-sdk')
is generated, while the desired import isconst AElf = require('aelf-sdk')
.Steps To Reproduce
Ensure that the project includes dependencies that rely on process or other Node.js built-in modules.
Import the bundled file in a Node.js environment using
const AElf = require('aelf-sdk')
.The Current Behavior
The bundled output throws errors indicating that process or other built-in Node.js modules are missing. The CommonJS module export in the bundled file results in the import statement
const { AElf } = require('aelf-sdk')
, which is not the intended usage.The Expected Behavior
The bundled output should include necessary polyfills or configuration to avoid errors related to missing process or other built-in Node.js modules. The CommonJS module export should result in the import statement const AElf = require('aelf-web3.js') to ensure correct usage in a Node.js environment.
Environment
Package: aelf-web3.js Node.js Version: v20.8.1