Here is a repository for reproducing the issue:
https://github.com/lpellegr/pwa-starter-kit-firebase-storage-packaging
The example is based on _pwa-start-kit-no-redux_ template. I have simply added the following lines:
Run yarn install, polymer serve, open http://127.0.0.1:8081.
At this stage, with no bundling the app works properly. All firebase modules are loaded (included storage).
Now, run yarn build:prpl-server, yarn serve:prpl-server, then open http://127.0.0.1:8080.
On Chrome, I get the following error:
Uncaught TypeError: Cannot read property 'path' of null
at Function.t.makeFromBucketSpec (firebase-storage.js:1)
at Function.t.extractBucket_ (firebase-storage.js:1)
at new t (firebase-storage.js:1)
at new t (firebase-storage.js:1)
at Object.storage (firebase-storage.js:1)
at t._getService (firebase-app.js:1)
at t.ur.(:8080/anonymous function) [as storage] (http://127.0.0.1:8080/esm-bundled/node_assets/firebase/firebase-app.js:1:34079)
at Object.f [as storage] (firebase-app.js:1)
at my-app.js:640
On Firefox the error is different most probably because served with es6 flavor instead of esm:

The fact that the app works with no bundling let's me think there is something wrong with Polymer bundler or a dependency used by it. Unfortunately, I have no knowledge about this part. Any ideas are welcome.
Why not importing Firebase using ES6 imports? There seems to be another issue too.
As a workaround, importing the global Firebase dependency (in public/index.html) allows creating working bundles:
<script src="node_modules/firebase/firebase.js"></script>
However, it has the drawback to load not required dependencies (e.g. _firebase-messaging_) but also to display a warning in production:
It looks like you're using the development build of the Firebase JS SDK.
When deploying Firebase apps to production, it is advisable to only import
the individual SDK components you intend to use.
@usergenic @aomarks Any ideas about what could be the issue?
@lpellegr will take a look.
@usergenic
Any joy with a fix for this?
If you blow out the yarn.lock here and do a fresh yarn install it should show this issue has been fixed.
Using [email protected]
Most helpful comment
@lpellegr will take a look.