Skip to content

Swc migration#26

Open
YASHMAHAKAL wants to merge 3 commits into
layer5io:masterfrom
YASHMAHAKAL:swc-migration
Open

Swc migration#26
YASHMAHAKAL wants to merge 3 commits into
layer5io:masterfrom
YASHMAHAKAL:swc-migration

Conversation

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor

@YASHMAHAKAL YASHMAHAKAL commented Feb 17, 2026

Notes for Reviewers

This PR fixes #

Migrates from Babel to SWC

Signed commits

  • Yes, I signed my commits.

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

YASHMAHAKAL commented Feb 17, 2026

@leecalcote should i also upgrade mocha version ? please take a look

Comment thread package.json Outdated
Copy link
Copy Markdown

@kishore08-07 kishore08-07 left a comment

Choose a reason for hiding this comment

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

@YASHMAHAKAL I noticed inconsistent module configurations across files: .swcrc and .swcrc.test are using commonjs, while rollup.config.js is configured for es6.
Could we align these configs or rely on Rollup to handle the module format to avoid potential build inconsistencies?

Comment thread package.json Outdated
Comment thread rollup.config.js Outdated
@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@YASHMAHAKAL I noticed inconsistent module configurations across files: .swcrc and .swcrc.test are using commonjs, while rollup.config.js is configured for es6. Could we align these configs or rely on Rollup to handle the module format to avoid potential build inconsistencies?

The different module types are intentional and follow the recommended pattern for Rollup + SWC.
The .swcrc commonjs is used by @swc-node/register in Node.js tests, node requires CommonJS.
Inside the Rollup plugin, we use es6 so rollup can perform static analysis and tree-shaking on es module import/export statements. If we set it to commonjs, SWC would convert imports to require() calls before rollup sees them, which would break rollup's tree shaking entirely.

@kishore08-07
Copy link
Copy Markdown

@YASHMAHAKAL I noticed inconsistent module configurations across files: .swcrc and .swcrc.test are using commonjs, while rollup.config.js is configured for es6. Could we align these configs or rely on Rollup to handle the module format to avoid potential build inconsistencies?

The different module types are intentional and follow the recommended pattern for Rollup + SWC. The .swcrc commonjs is used by @swc-node/register in Node.js tests, node requires CommonJS. Inside the Rollup plugin, we use es6 so rollup can perform static analysis and tree-shaking on es module import/export statements. If we set it to commonjs, SWC would convert imports to require() calls before rollup sees them, which would break rollup's tree shaking entirely.

@YASHMAHAKAL Thanks for clarifying, that makes sense.

@leecalcote
Copy link
Copy Markdown
Member

@saurabhraghuvanshii keep working this through, please.

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

@YASHMAHAKAL, did you test your changes? Did you see any improvement in build time?

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@saurabhraghuvanshii yes, build time was reduced to 900 ms vs 2.5 seconds

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@saurabhraghuvanshii however, i just resolved merge conflicts so i'm testing it again

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

@saurabhraghuvanshii yes, build time was reduced to 900 ms vs 2.5 seconds

Wow!!

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@saurabhraghuvanshii i have tested it again and new build time is - 1.2 seconds vs 4.5 seconds after having changes in master recently : )

Copy link
Copy Markdown
Member

@Rajesh-Nagarajan-11 Rajesh-Nagarajan-11 left a comment

Choose a reason for hiding this comment

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

Looks Good to me

Comment thread .eslintrc Outdated
@Rajesh-Nagarajan-11
Copy link
Copy Markdown
Member

Rajesh-Nagarajan-11 commented Mar 25, 2026

@YASHMAHAKAL did you test all the scripts that are mentioned in package.json especially ( npm run dev & npm run build ) ?

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@YASHMAHAKAL did you test all the scripts that are mentioned in package.json especially ( npm run dev & npm run build ) ?

yes @Rajesh-Nagarajan-11
image

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@saurabhraghuvanshii take a look again, i've made the fix

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

@miacycle please merge this then I can update my Pr.

Comment thread .swcrc Outdated
Comment thread vitest.config.mts Outdated
Comment thread package.json Outdated
@YASHMAHAKAL YASHMAHAKAL requested a review from leecalcote April 25, 2026 13:32
Comment thread src/components/TableFilter.js
Comment thread rollup.config.mjs
Comment thread .swcrc Outdated
@Bharath314
Copy link
Copy Markdown

There are some conflicts that have to be resolved.

@YASHMAHAKAL YASHMAHAKAL marked this pull request as draft May 9, 2026 09:59
@YASHMAHAKAL YASHMAHAKAL force-pushed the swc-migration branch 2 times, most recently from 554571a to 27d26af Compare May 9, 2026 12:28
Copy link
Copy Markdown
Contributor Author

@YASHMAHAKAL YASHMAHAKAL left a comment

Choose a reason for hiding this comment

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

merge conflicts have been resolved

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

remove @babel/runtime-corejs3 dependency

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

replaced 8-line IE11-era object with MUI v7 query string

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

removed mui/emotions

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

deleted .eslintrc

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

update rollup config

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

eliminate .eslintrc, fixed jsc.target errors

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

inconsistency fixed

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
@YASHMAHAKAL YASHMAHAKAL marked this pull request as ready for review May 9, 2026 19:10
Comment thread test/setup-vitest.js
Comment on lines +1 to +16
'use strict';

// React 19 + Enzyme compatibility shims for Vitest. Mirrors master's setup-mocha-env.js.

// beforeAll/afterAll are Vitest globals (globals:true). Alias for Mocha-style tests.
global.before = beforeAll;
global.after = afterAll;

afterAll(async () => {
await new Promise((resolve) => setTimeout(resolve, 100));
});

// jsdom polyfills
if (global.document) {
global.document.createRange = () => ({
setStart: () => {},
Copy link
Copy Markdown
Contributor Author

@YASHMAHAKAL YASHMAHAKAL May 9, 2026

Choose a reason for hiding this comment

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

test/setup-vitest.cjs is a temporary compatibility shim. The existing test suite relies on Enzyme, which is incompatible with React 19 — ReactDOM.findDOMNode, testUtils.Simulate, and the internal hook dispatcher were all removed in React 19, causing all 234 tests to fail. This file patches them back in so the tests pass for now, mirroring the same approach master uses in test/setup-mocha-env.js. The proper fix is migrating the test suite from Enzyme to React Testing Library, which I will do in a follow-up PR. Keeping it separate avoids stacking a large test refactor on top of this build toolchain migration, making both PRs easier to review and merge independently.

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor Author

@leecalcote @Rajesh-Nagarajan-11 @saurabhraghuvanshii i've resolved all the merge conflicts, all the tests are passing, please take a look whenever convenient : )

@YASHMAHAKAL YASHMAHAKAL force-pushed the swc-migration branch 2 times, most recently from ca86bea to 5452615 Compare May 9, 2026 23:15
@YASHMAHAKAL YASHMAHAKAL requested a review from rishiraj38 May 9, 2026 23:26
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

addressed compatibility issues and test configuration fixes

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

leftover warnings fixed

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

applied suggestions

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

fixed bugs for validateDOM and props nesting

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

coverage differentiated and npm run coverage fixed

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

fix: update dependencies and config

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

changed tests to unplugin-swc

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

apply suggestions

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

vitest.config.mts edited

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>

added test/setup-vitest.cjs

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
Copy link
Copy Markdown

@Oluwatunmise-olat Oluwatunmise-olat left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants