Skip to content

Commit

Permalink
Rollup JS files with rollup-typescript-plugin
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
dlarocque committed Sep 16, 2024
1 parent 629919e commit a520ce5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/firebase/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const typescriptPlugin = rollupTypescriptPlugin({

const typescriptPluginCDN = rollupTypescriptPlugin({
typescript,
allowJs: true,
include: [ "*.ts", "**/*.ts", "*.js", "**/*.js"],
tsconfigOverride: {
compilerOptions: {
declaration: false
Expand Down

0 comments on commit a520ce5

Please sign in to comment.