firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Firestore: Add "development" export to package.json/rolllup that leaves in assertion messages and skips minification

Open dconeybe opened this issue 1 year ago • 3 comments

Add a "development" conditional export for Firestore (https://nodejs.org/api/packages.html#conditional-exports).

This new "development" export is the same as the existing non-development (a.k.a. "production") export except that it is not minified and does not strip out the assertion messages. The "development" export can be useful when customers run into the generic "INTERNAL ASSERTION FAILED: Unexpected state" error message (e.g. https://github.com/firebase/firebase-js-sdk/issues/4451). Such customers can make debugging easier, especially when reporting issues on GitHub, by switching to the "development" export to get the full error message (instead of "Unexpected state") and non-minified stack trace.

To use the "development" export in a node.js application, specify -C development to node on the command line. Bundlers such as rollup and webpack have their own bespoke mechanisms for selecting a non-default bundle. For example, a rollup script might do something like this to select the "development" export:

import resolve from '@rollup/plugin-node-resolve';
...
export default {
  ...
  plugins: [
    resolve({ browser: true, exportConditions: ['development'] }),
    ...
  ]
};

(see https://www.npmjs.com/package/@rollup/plugin-node-resolve#exportconditions for details).

Work In Progress

This PR is a work-in-progress. As of Jan 22, 2024, work on this PR has been de-prioritized but I'm leaving it here so it can be picked up in the future. Googlers see b/302682954 for details.

dconeybe avatar Jan 12 '24 17:01 dconeybe

🦋 Changeset detected

Latest commit: 4cca0ea06a44bab801e95bbc94035a08990eb318

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/firestore Minor
firebase Minor
@firebase/firestore-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jan 12 '24 17:01 changeset-bot[bot]

Size Report 1

Affected Products

No changes between base commit (991fa27) and merge commit (05a08d8).

Test Logs

google-oss-bot avatar Jan 12 '24 17:01 google-oss-bot

Size Analysis Report 1

Affected Products

No changes between base commit (991fa27) and merge commit (05a08d8).

Test Logs

google-oss-bot avatar Jan 12 '24 17:01 google-oss-bot