Skip to content

Partial imports with rollup failing #47

Closed
@hville

Description

@hville

Following up on #45 and on @jshcrowthe's comment:

Use case: just importing the database layer to develop and unit test individual modules that need a common async data store. They will likely eventually be used in the browser but development, unit testing, and packaging is just so much easier and faster in node.

//app.js
import * as firebase from './node_modules/firebase/app'
import './node_modules/firebase/database'
firebase.initializeApp({databaseURL: 'x.y.z'}, 'local').database().goOffline()
  1. using rollup in the CLI >rollup -o app.bld.js -f cjs app.js
     'initializeApp' is not exported by 'node_modules\firebase\app.js'
     Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
  1. using rollup in a script with the nodeResolve() and commonjs({include: 'node_modules/**'}) plugins
    'initializeApp' is not exported by 'node_modules\firebase\app.js'
  1. Tried importing from ./node_modules/firebase/firebase-app but being build for the browser I get a navigator error in node

  2. I also tried many a few combinations directly in the firebase/app/ folder with browserify to get an intermediate build that would be easier to consume but the build system looks like it was hacked to suit babel.

I understand I am trying to use the database component in a way that is not the intended typical use but I thought that if there were less frictions in just using the firebase toolset it would be much easier to get there progressively.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions