js-stellar-sdk icon indicating copy to clipboard operation
js-stellar-sdk copied to clipboard

Consolidate the build process to a single build tool

Open janewang opened this issue 1 year ago • 5 comments

Modernization of the Build System: While great strides have been made in upgrading the stack from Webpack 4 to Webpack 5 (see, for example, stellar-base#584), there’s still much more to be done. There are far superior build systems out there today that will lead to smaller and faster bundle sizes for downstream systems. We can also make the effort to support a newer package manager, like modern npm or Yarn 3.

This may or may not require downstream systems to also adapt to the new build system.

janewang avatar Jul 09 '24 19:07 janewang

  • [x] remove axios - ready for review
  • [x] eventSource - ready for review
  • [x] react-native - testing framework needs more research (node pkg to remove some packages for non-browser)

janewang avatar Sep 03 '24 20:09 janewang

Tree shaking is most likely build in according to @BlaineHeffron. Disable axios for node will be done through tree shaking

janewang avatar Sep 10 '24 20:09 janewang

React native requires a workaround even if you use the no-eventsource version of the SDK. Here is what worked for me:

in the metro config: let blacklistedModules = ["eventsource"];

  resolver: {
    resolveRequest: (context, moduleName, platform) => {
      if (blacklistedModules.includes(moduleName)) {
        return {
          filePath: path.resolve(__dirname + "/empty-module.js"),
          type: "sourceFile"
        };
      } else {
        return OriginalResolver.resolve(
          { ...context, resolveRequest: undefined },
          moduleName,
          platform
        );
      }
    }
  }

Create a blank file empty-module.js.

The no-eventsource and no-axios versions were merged in https://github.com/stellar/js-stellar-sdk/pull/1066 and https://github.com/stellar/js-stellar-sdk/pull/1038

BlaineHeffron avatar Oct 03 '24 18:10 BlaineHeffron

Heroic accomplishment, can be closed I think 👍

Shaptic avatar Oct 07 '24 21:10 Shaptic

Consolidated to a single build tool is has not been completed.

janewang avatar Oct 08 '24 20:10 janewang