-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from Terser and Babel to SWC #6920
base: main
Are you sure you want to change the base?
Conversation
Any change to sizes? |
Also is there a difference in ECMA compliance, if there is a difference between ES5 versio s, and what it results in? |
It has the same targets for both UMD and ES builds, so should match current
outputs.
I need to adjust some settings to get the build size back in line though,
so consider this draft for now.
…On Fri, 6 Sep 2024 at 18:15, mrmaxm ***@***.***> wrote:
Also is there a difference in ECMA compliance, if there is a difference
between ES5 versio s, and what it results in?
—
Reply to this email directly, view it on GitHub
<#6920 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADJFLFPULMRTOP2IBLJDHTZVHPLDAVCNFSM6AAAAABNY3P7G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZUGQ4TGNBTGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If it is not possible to bring the build size to what terser is capable of, then we can consider to use this for a debug build, as it is usually the one that takes the most of the time during development and its size is of less importance. |
Below are the file sizes. Will continue investigating
|
package.json
Outdated
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/pluginutils": "^5.1.0", | ||
"c8": "^10.1.2", | ||
"@swc/core": "^1.7.23", | ||
"c8": "^9.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come c8 was bumped down in this PR?
The wins from this look extremely compelling. I'd be supportive of switching. |
- Added "peer": true to several existing dependencies to indicate peer dependencies. - Introduced new modules: jackspeak (v3.4.3) and package-json-from-dist (v1.0.1) with their respective details. - Added path-scurry (v1.11.1) and its dependency lru-cache (v10.4.3) with funding information. These changes enhance dependency management and ensure compatibility with peer dependencies.
- Eliminated the babel-parser dependency from the ESLint configuration file. - Updated the parser options to ensure compatibility with the existing setup. These changes streamline the ESLint configuration and reduce unnecessary dependencies.
- Changed the import name of the SWC plugin from 'swc' to 'swcPlugin' for clarity. - Updated all instances in the buildTarget function to use the new import name. These changes improve code readability and maintainability.
- Removed several unused Babel-related dependencies from package.json and package-lock.json to streamline the project. - Updated the package-lock.json to reflect the removal of these dependencies and added optional flags where applicable. - Enhanced dependency management by ensuring that only necessary modules are retained, improving overall project maintainability.
… rollup-spaces-to-tabs.mjs - Deleted the rollup-script-target.mjs file, streamlining the build process. - Updated swcOptions to ensure comments are preserved in the output when not minifying. - Clarified documentation in rollup-spaces-to-tabs.mjs regarding the plugin's functionality. These changes enhance code maintainability and improve the clarity of the build configuration.
…ting - Adjusted the formatting of the `pure_funcs` array in the `swcOptions` function to ensure consistency. - This change enhances code readability and maintains the existing functionality of the build configuration.
- Upgraded the version of the 'playcanvas' package from 2.3.0-dev to 2.4.0-dev. - Updated several dependencies, including '@webgpu/types' from ^0.1.40 to ^0.1.52, and '@playcanvas/eslint-config' from ^2.0.2 to ^2.0.8. - Removed multiple unused rebuild package lock
…s for Rollup. See vitejs/vite#15532 - Added optional dependencies for various Rollup packages, including support for multiple platforms (Linux, Darwin, FreeBSD, Windows). - Updated package-lock.json to reflect the addition of these optional dependencies and their respective versions. - This change enhances cross-platform compatibility and ensures that the build process can leverage the appropriate Rollup binaries as needed.
…lated dependencies - Upgraded @swc/core to version 1.10.1 and updated its dependencies across various platforms. - Removed the optional dependency for @rollup/rollup-linux-x64-gnu. - Updated @swc/types to version 0.1.17 for improved compatibility. - These changes enhance the project's build capabilities and ensure better support for the latest SWC features.
Comparison of Existing Build System vs SWC
Observations
|
parserOptions: { | ||
requireConfigFile: false | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't need the Babel parser any more, can we also drop parserOptions
? I think we only added this for Babel.
This PR replaces Babel + Terser with SWC which improves the build time of each target.
The same ES5 targets are used for UMD build outputs.
With Terser/Babel ~ 1m40s
With SWC ~ 51s
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.