Webpack and On-Demand Firebase SDK Auto-configuration

101 views
Skip to first unread message

Neta L

unread,
Dec 10, 2017, 10:20:21 AM12/10/17
to Firebase Google Group
Hello everyone,

I was wondering if there a way to import On-Demand Firebase SDK Auto-configuration using webpack & dependencies?

I know i can just add the tags

<script src="/__/firebase/3.7.4/firebase-app.js"></script>
    <script src="/__/firebase/3.7.4/firebase-auth.js"></script>
    <script src="/__/firebase/init.js"></script>
...



but I prefer to avoid this solution and use dependencies instead.

any ideas?

Thanks,

Neta

Michael Bleigh

unread,
Dec 11, 2017, 4:51:29 PM12/11/17
to fireba...@googlegroups.com

Hey Neta,

For the SDK, I’d recommend just using NPM to install it and have Webpack use it from there. For the init.js, one thing you can do is use the output of the firebase setup:web command from the Firebase CLI. One way to do this is to install firebase-tools as a dependency in your package.json and use it programmatically:

const firebaseTools = require('firebase-tools');
firebaseTools.setup.web().then(config => {
  // config is your firebase configuration object
});

You could use this in combination with our new predeploy hooks to automatically inline the configuration for the specific project you’re deploying when building.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/f5eea187-3789-4ed0-b73e-8a5b9f845377%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages