Skip to content

Swc migration#26

Open
YASHMAHAKAL wants to merge 4 commits intolayer5io:masterfrom
YASHMAHAKAL:swc-migration
Open

Swc migration#26
YASHMAHAKAL wants to merge 4 commits intolayer5io:masterfrom
YASHMAHAKAL:swc-migration

Conversation

@YASHMAHAKAL
Copy link

@YASHMAHAKAL YASHMAHAKAL commented Feb 17, 2026

Notes for Reviewers

This PR fixes #

Migrates from Babel to SWC

Signed commits

  • Yes, I signed my commits.

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

YASHMAHAKAL commented Feb 17, 2026

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

"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server -d --progress --colors",
"test": "cross-env NODE_ENV=test mocha --require ./test/babel-register.js --extensions js,jsx test/**/*.test.js",
"test": "cross-env NODE_ENV=test mocha --require ./test/swc-register.js --extension js --extension jsx test/**/*.test.js",

Choose a reason for hiding this comment

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

@YASHMAHAKAL two times --extension flag, why?

Copy link
Author

@YASHMAHAKAL YASHMAHAKAL Feb 17, 2026

Choose a reason for hiding this comment

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

@saurabhraghuvanshii instead of the comma-separated values, i just added it twice, it matches mocha's current cli behavior

Copy link

@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?

package.json Outdated
@@ -107,7 +97,6 @@
"dependencies": {
"@babel/runtime-corejs3": "^7.12.1",

Choose a reason for hiding this comment

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

@YASHMAHAKAL @babel/runtime-corejs3 is still in dependencies. Can we remove this?

Copy link
Author

Choose a reason for hiding this comment

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

@kishore08-07, i had a reason for this, but i thought on that reason again, and now i think i should be removing it, Thanks.

rollup.config.js Outdated
Comment on lines 33 to 38
targets: {
ie: '11',
chrome: '58',
firefox: '54',
safari: '10',
edge: '15',

Choose a reason for hiding this comment

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

@YASHMAHAKAL shall we update to modern baselines?

Copy link
Author

Choose a reason for hiding this comment

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

implemented, this made build even faster.. Thanks !

@YASHMAHAKAL
Copy link
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.

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

@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.

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
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.

3 participants