chore!: bump compilation target from ES5 to ES2017#776
Open
TrevorBurnham wants to merge 1 commit intoaws-observability:mainfrom
Open
chore!: bump compilation target from ES5 to ES2017#776TrevorBurnham wants to merge 1 commit intoaws-observability:mainfrom
TrevorBurnham wants to merge 1 commit intoaws-observability:mainfrom
Conversation
Remove Babel transpilation pipeline and bump TypeScript/webpack targets from ES5 to ES2017. The entry point already gates on fetch + sendBeacon, which guarantees ES2017+ browser support at runtime. - tsconfig target: es5 -> es2017 - webpack target: ['web', 'es5'] -> ['web', 'es2017'] - Remove babel-loader, @babel/preset-env, @babel/plugin-transform-runtime - Remove @babel/runtime from production dependencies - Update browserslist to explicit minimum versions - Bundle size reduction: -37 KB raw (-23%), -4.4 KB gzipped (-10%) This is a breaking change for consumers using older bundlers (e.g. Webpack 4) that do not support ES2017 input. Refs: aws-observability#775
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #775
Summary
This PR removes the Babel transpilation pipeline and bumps the TypeScript/webpack compilation target from ES5 to ES2017, eliminating significant transpilation overhead from the CDN bundle.
Changes
tsconfig.json"target": "es5"→"es2017"webpack/webpack.common.js['web', 'es5']→['web', 'es2017']; removedbabel-loaderpipeline entirely; simplifiedexcludefrom/node_modules\/(?!@aws-sdk)/to/node_modules/(see note below)package.json@babel/runtime(prod),@babel/preset-env,babel-loader,@babel/plugin-transform-runtime(dev); updatedbrowserslistfrom["defaults"]to["Chrome >= 55", "Firefox >= 52", "Safari >= 10.1", "Edge >= 15"]Note on the exclude pattern change: The old webpack config used
exclude: /node_modules\/(?!@aws-sdk)/to run@aws-sdkcode through Babel. The new config excludes all ofnode_modulessince Babel is removed andts-loaderonly needs to process our source. The@smithy/*and@aws-crypto/*runtime dependencies already ship ES2017-compatible JS. If a future SDK version ships syntax beyond ES2017, the webpack target would need to be bumped accordingly or a loader re-added for those packages.Bundle size impact
The savings come from eliminating Babel's async/await state machine transforms (
__awaiter/__generator),for...ofiterator protocol boilerplate, and the@babel/runtimehelpers.Breaking changes
This change should be released as a new major version, for two reasons:
fetchandsendBeacon. Thebrowserslisthas been updated to reflect that limitation.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.