Skip to content

Webpack to rollup - #1397

Merged
Ryang-21 merged 10 commits into
modernizationfrom
webpack-to-rollup
Apr 28, 2026
Merged

Webpack to rollup#1397
Ryang-21 merged 10 commits into
modernizationfrom
webpack-to-rollup

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

Replaces the webpack + babel build toolchain with rollup. The SDK now ships both library and browser-UMD builds through a single rollup.config.mjs, produces a flatter output layout, and generates type declarations exactly once.

Library output moves to lib/esm/ (ESM) and lib/cjs/ (CJS), with the axios variant mirroring at lib/axios/esm/ and lib/axios/cjs/. Type declarations are consolidated into lib/types/ — one shared copy for both transport variants, since their public API is identical and only the http-client implementation differs. The exports map is updated accordingly; every subpath (including the new ./http-client/axios) resolves cleanly under Node16 module resolution. The dist/ UMD bundles (stellar-sdk.js, stellar-sdk-axios.js, plus .min.js counterparts) keep the same filenames so CDN consumers see no change.

The _build script now runs rollup -c, USE_AXIOS=true rollup -c, and a single tsc types pass. The old _babel, _babel:esm, _babel:cjs, build:ts, build:browser*, and temp-tsconfig steps are gone, along with babel.config.js,config/webpack.config.browser.js, config/babel-plugin-alias-http-client.js, config/set-output-dir.js, and
config/build.config.js. Babel, webpack, terser-webpack-plugin, node-polyfill-webpack-plugin, eslint-webpack-plugin, and null-loader are removed from devDependencies in favor of the rollup plugin set plus browserify-zlib (needed because axios's HTTP adapter reads zlib.constants.Z_SYNC_FLUSH at module init, and rollup-plugin-polyfill-node's zlib shim omits .constants).

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Apr 24, 2026
@Ryang-21 Ryang-21 linked an issue Apr 24, 2026 that may be closed by this pull request
3 tasks
@Ryang-21
Ryang-21 requested review from Copilot and quietbits April 24, 2026 20:26
@socket-security

socket-security Bot commented Apr 24, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

Size Change: -15 MB (-76.5%) 🏆

Total Size: 4.61 MB

📦 View Changed
Filename Size Change
dist/stellar-sdk-axios.js 1.82 MB -3.6 MB (-66.44%) 🏆
dist/stellar-sdk-axios.min.js 872 kB -3.66 MB (-80.78%) 🏆
dist/stellar-sdk.js 1.22 MB -4.07 MB (-76.91%) 🏆
dist/stellar-sdk.min.js 703 kB -3.68 MB (-83.98%) 🏆

compressed-size-action

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the webpack + babel build pipeline with Rollup, restructures build outputs into lib/esm, lib/cjs, and consolidated lib/types, and updates tests/configs to reference the new layout.

Changes:

  • Add rollup.config.mjs to build both preserved-module library outputs and UMD bundles (including axios variant handling).
  • Update package.json exports/scripts and Vitest coverage configs to align with the new output directories.
  • Remove webpack/babel build configuration and update test imports/type references for the new lib/esm + lib/types structure.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rollup.config.mjs New Rollup build for library (ESM/CJS) + UMD dist bundles, with axios and polyfill handling.
package.json Updates entrypoints/exports, build scripts, and devDependencies for the Rollup toolchain.
config/vitest.config.ts Adjust coverage inclusion to lib/esm/**/*.js.
config/vitest.config.e2e.ts Adjust coverage inclusion to lib/esm/**/*.js.
config/vitest.config.browser.ts Adjust coverage inclusion to lib/esm/**/*.js.
config/vitest.config.axios.ts Adjust axios coverage inclusion to lib/axios/esm/**/*.js.
config/tsconfig.json Emit declarations into lib/types once, using Node16 module settings.
eslint.config.js Ignore rollup.config.mjs for linting.
test/test-utils/stellar-sdk-import.ts Update typed imports to lib/types and runtime test loading to lib/esm / lib/axios/esm.
test/unit/server/soroban/get_classic_entries.test.ts Update import path to lib/esm.
test/unit/call_builders.test.ts Update import path to lib/esm.
test/e2e/src/constructor-args.test.ts Update import paths to lib/esm.
README.md Removes the sodium-native note.
config/webpack.config.browser.js Removed (webpack browser build deleted).
babel.config.js Removed (babel build deleted).
config/babel-plugin-alias-http-client.js Removed (replaced by Rollup plugin logic).
config/build.config.js Removed (no longer needed).
config/set-output-dir.js Removed (tsconfig tmp output step removed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
"postbuild:lib:axios": "node config/write-module-type.js lib/axios/cjs commonjs",
"clean": "rm -rf lib/ dist/ coverage/ .nyc_output/ jsdoc/ test/e2e/.soroban",
"docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json",
"docs": "jsdoc -c ./config/.jsdoc.json",

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs script no longer builds lib/, but config/.jsdoc.json is configured to document sources under lib/ (and excludes lib/axios). Running yarn docs after a clean install (or yarn clean) will produce incomplete docs or fail; consider restoring a build step (e.g., yarn build:lib / yarn build:prod) before invoking jsdoc.

Suggested change
"docs": "jsdoc -c ./config/.jsdoc.json",
"docs": "yarn build:lib && jsdoc -c ./config/.jsdoc.json",

Copilot uses AI. Check for mistakes.
Comment thread package.json
"module": "./lib/esm/index.js",
"types": "./lib/types/index.d.ts",
"files": [
"/types",

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files still includes /types, but the package’s types entry now points to ./lib/types/index.d.ts and there is no top-level types/ directory. This makes the publish whitelist misleading and may omit/duplicate the intended type artifacts; consider removing /types (or replacing it with the correct path under lib/types).

Suggested change
"/types",

Copilot uses AI. Check for mistakes.
Comment thread test/tsconfig.json
Comment thread rollup.config.mjs
// source, we load stellar-base at config time, enumerate its runtime exports,
// and serve a virtual module with explicit `export { ... }` re-exports
// whenever `@stellar/stellar-base` is imported.
// This can be removed once stellar-base is merged into this repo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mark this as TODO: to make sure we don't forget to remove it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is addressed in the base migration pr

@Ryang-21
Ryang-21 merged commit a14aa3d into modernization Apr 28, 2026
2 of 7 checks passed
@Ryang-21
Ryang-21 deleted the webpack-to-rollup branch April 28, 2026 17:38
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Apr 28, 2026
@Ryang-21 Ryang-21 mentioned this pull request Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Modernization 3/4: Move build tooling to Rollup

3 participants