From eed86448caeae6815dcea0722b599ae702f2b9f6 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 16 Sep 2024 14:27:24 -0400 Subject: [PATCH] Rollup JS files with rollup-typescript-plugin The rollup-typescript-plugin does not transpile JS files using the TS compiler by default. This means that external dependencies that provide JS bundles will not be transpiled to the target ES version specified in the TypeScript config used by the plugin. This resulted in one of our dependencies (https://github.com/jakearchibald/idb) being included in the CDN bundles without being transpiled to ES5 (the target ES version). Since this dependencies bundle uses ES2018 syntax (object spread operator `{ ...x }`), this upgraded our CDN bundles' minimum ES version requirement to ES2018 which isn't compatible with older browser versions. To see the ES2018 syntax in one of the CDN bundles, see https://www.gstatic.com/firebasejs/10.13.1/firebase-app.js and search for `...oldTraps`. --- packages/firebase/rollup.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/firebase/rollup.config.js b/packages/firebase/rollup.config.js index beeb2123ba8..fda0dc0ebb0 100644 --- a/packages/firebase/rollup.config.js +++ b/packages/firebase/rollup.config.js @@ -36,6 +36,8 @@ const typescriptPlugin = rollupTypescriptPlugin({ const typescriptPluginCDN = rollupTypescriptPlugin({ typescript, + allowJs: true, + include: ['*.ts', '**/*.ts', '*.js', '**/*.js'], tsconfigOverride: { compilerOptions: { declaration: false