DEV: @babel/plugin-proposal-decorators -> decorator-transforms (#25290)

decorator-transforms (https://github.com/ef4/decorator-transforms) is a modern replacement for babel's plugin-proposal-decorators. It provides a decorator implementation using modern browser features, without needing to enable babel's full suite of class feature transformations. This improves the developer experience and performance.

In local testing with Google's 'tachometer' tool, this reduces Discourse's 'init-to-render' time by around 3-4% (230ms -> 222ms).

It reduces our initial gzip'd JS payloads by 3.2% (2.43MB -> 2.35MB), or 7.5% (14.5MB -> 13.4MB) uncompressed.
This commit is contained in:
David Taylor
2024-05-08 10:40:51 +01:00
committed by GitHub
parent f74983e2e1
commit 0f4520867b
17 changed files with 151 additions and 12 deletions

View File

@ -9,9 +9,7 @@ class DiscourseJsProcessor
# To generate a list of babel plugins used by ember-cli, set
# babel: { debug: true } in ember-cli-build.js, then run `yarn ember build -prod`
DISCOURSE_COMMON_BABEL_PLUGINS = [
["proposal-decorators", { legacy: true }],
"proposal-class-properties",
"proposal-private-methods",
["decorator-transforms", { runEarly: true }],
"proposal-class-static-block",
"transform-parameters",
"proposal-export-namespace-from",