diff --git a/rollup.config.js b/rollup.config.js index 03504e1..81039c0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -78,7 +78,18 @@ const baseConfig = { const entryPoints = [ { input: './src/picker/PickerElement.js', - output: './picker.js' + output: './picker.js', + plugins: [ + // Replace newer syntax in Svelte v4 to avoid breaking iOS <13.4 + // https://github.com/nolanlawson/emoji-picker-element/pull/379 + replace({ + 'array_like_or_iterator?.length': 'array_like_or_iterator && array_like_or_iterator.length', + '$$ = undefined;': '', // not necessary to initialize class prop to undefined + '$$set = undefined;': '', // not necessary to initialize class prop to undefined + delimiters: ['', ''], + preventAssignment: true + }) + ] }, { input: './src/database/Database.js', diff --git a/shims/svelte-v3-shim.js b/shims/svelte-v3-shim.js index b04a9b3..8dfa849 100644 --- a/shims/svelte-v3-shim.js +++ b/shims/svelte-v3-shim.js @@ -3,7 +3,7 @@ // this code is copied from svelte v4 /* eslint-disable camelcase */ export function ensure_array_like_shim (array_like_or_iterator) { - return array_like_or_iterator?.length !== undefined + return (array_like_or_iterator && array_like_or_iterator.length !== undefined) ? array_like_or_iterator : Array.from(array_like_or_iterator) }