-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
[READ] Step 1: Are you in the right place?
Yes. This is an import problem with the sdk.
[REQUIRED] Step 2: Describe your environment
- Xcode version: _____
- Firebase SDK version: firebase@4.1.3
- Library version: _____
- Firebase Product: _____ (auth, database, storage, core, messaging, etc)
[REQUIRED] Step 3: Describe the problem
https://www.npmjs.com/package/firebase says:
If you are using ES6 imports or TypeScript:
import * as firebase from 'firebase';
var app = firebase.initializeApp({ ... });
This fails for me. I note a few oddities in the first line:
- The path is not legal module path: needs to be complete http://paths/to/firebase.js or a relative path like ./firebase.js. Note the .js and the pathyness.
- The trailing ";" is illegal.
Attempting loading the module in a module-aware browser fails to load with the error described below.
Steps to reproduce:
In my repo: npm install firebase and copy ./node_modules/firebase/firebase.js to a test dir/
Create a test html file in the same dir:
<html>
<head>
<title>test</title>
</head>
<body>
<script type="module">
import * as firebase from './firebase.js'
</script>
</body>
</html>
Run this in a module-ready browser. I used Canary and Safari. Both get the same error:
TypeError: undefined is not an object (evaluating 'k.navigator')
Safari shows this (un-minified)

Relevant Code:
See above. Also this Stack Overflow:
https://stackoverflow.com/questions/31221357/webpack-firebase-disable-parsing-of-firebase
Reactions are currently unavailable