Skip to content

Possible Mismatch with Typings and Browser Bundles? #716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gauntface opened this issue Apr 23, 2018 · 8 comments
Closed

Possible Mismatch with Typings and Browser Bundles? #716

gauntface opened this issue Apr 23, 2018 · 8 comments
Assignees

Comments

@gauntface
Copy link

gauntface commented Apr 23, 2018

When build a Firebase project using Typescript, I'm outputting a ESModules bundle (which works fine) and then run that through Rollup to generate a final browser bundle.

At the moment Rollup is outputting the following error:

'initializeApp' is not exported by 'node_modules\firebase\app\index.js'

The Typescript code this relates to is simply:

import * as firebase from 'firebase/app';
const firebaseApp = firebase.initializeApp(config);

Firebase 4.13.1

Any ideas what might be causing this? Seems that ionic have been having this for some time: angular/angularfire#565 where a workaround is to basically exclude firebase from the rollup build and import as a global asset :(

@google-oss-bot
Copy link
Contributor

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

@google-oss-bot
Copy link
Contributor

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

@gauntface
Copy link
Author

Previous bug with exact same issue was closed: #47

@gauntface
Copy link
Author

Rollup Config is:

return rollupStream({
    rollup,
    input: moduleFile,
    output: {
      format: 'iife',
      sourcemap: true,
      name: path.basename(moduleFile),
    },
    plugins: [
      // Enable rollup to resolve node modules
      resolve({
        module: true,
        browser: true,
      }),
      // Converts commonjs to ES6 modules
      commonjs(),
      // This module enabled Rollup to *ingest* a sourcemap to apply
      // further manipulations
      sourcemapPlugin(),
      // Minify the bundled JS
      uglifyPlugin({}, esMinify),
    ],
  })

@codinronan
Copy link

@gauntface check this issue also opened yesterday: #715

Basically the scoped packages don't work yet, you need to import from firebase instead of firebase/app. This breaks tree shaking (which is what that rollup error means) but is unavoidable until all the package splitting is done. The Typescript types report that they are independent but in the actual JS they are not.

@jshcrowthe
Copy link
Contributor

@gauntface I know we had some issues w/ our typings can you try installing 5.x again and see if the issue still exists?

@Feiyang1
Copy link
Member

@gauntface are you still facing the issue with the latest firebase version ?

@gauntface
Copy link
Author

I think I had to drop Firebase or take some other approach for my project, so no idea if this is an issue still or not sorry. Feel free to close it.

@firebase firebase locked and limited conversation to collaborators Oct 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants