Skip to content

Commit

Permalink
Compiling modern bundle using es2020 (#2917)
Browse files Browse the repository at this point in the history
* using es2020

* Delete packages/lib/xxxx.browserslistrc

* changeset

* removing default es2022 value
  • Loading branch information
ribeiroguilherme authored Oct 30, 2024
1 parent d6e2254 commit 35e329a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-fishes-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': patch
---

Lowered ECMAScript version to 2020 in order to support older iOS versions
2 changes: 1 addition & 1 deletion packages/lib/config/rollup.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default () => {
replaceValues({ bundleType: BUNDLE_TYPES.esm, buildType: 'development' }),
convertJsonToESM(),
compileCSS({}),
compileJavascript({ target: 'es2022' })
compileJavascript({ target: 'es2020' })
],
output: [
{
Expand Down
9 changes: 7 additions & 2 deletions packages/lib/config/rollup.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ export const compileCSS = ({ extract = 'adyen.css' } = {}) =>
extract: extract
});

export const compileJavascript = ({ target = 'es2022', sourceMaps = false } = {}) =>
swc(
export const compileJavascript = ({ target, sourceMaps = false } = {}) => {
if (!target) {
throw Error('Rollup plugins: compileJavascript task - "target" is missing');
}

return swc(
defineRollupSwcOption({
tsconfig: '../tsconfig.json',
jsc: {
Expand All @@ -70,6 +74,7 @@ export const compileJavascript = ({ target = 'es2022', sourceMaps = false } = {}
inlineSourcesContent: false
})
);
};

export const minify = ({ isESM } = { isESM: true }) => terser({ module: isESM });

Expand Down
4 changes: 2 additions & 2 deletions packages/lib/config/rollup.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default () => {
replaceValues({ bundleType: BUNDLE_TYPES.esm, buildType: 'production' }),
convertJsonToESM(),
compileCSS(),
compileJavascript({ target: 'es2022', sourceMaps: true }),
compileJavascript({ target: 'es2020', sourceMaps: true }),
minify()
],
output: [
Expand Down Expand Up @@ -99,7 +99,7 @@ export default () => {
replaceValues({ bundleType: BUNDLE_TYPES.umd, buildType: 'production' }),
convertJsonToESM(),
compileCSS(),
compileJavascript({ sourceMaps: true }),
compileJavascript({ target: 'es2020', sourceMaps: true }),
minify({ isESM: false })
],
output: {
Expand Down

0 comments on commit 35e329a

Please sign in to comment.