Skip to content
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

es6 import fails with module-aware browsers #145

Closed
backspaces opened this issue Jul 19, 2017 · 2 comments
Closed

es6 import fails with module-aware browsers #145

backspaces opened this issue Jul 19, 2017 · 2 comments

Comments

@backspaces
Copy link

[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)
snap 07 19 17-11 17 07

Relevant Code:

See above. Also this Stack Overflow:

https://stackoverflow.com/questions/31221357/webpack-firebase-disable-parsing-of-firebase

@google-oss-bot
Copy link

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

@paulb777
Copy link
Member

This looks like a Firebase JavaScript SDK issue. Please reopen at https://github.com/firebase/firebase-js-sdk/issues

@firebase firebase locked and limited conversation to collaborators Nov 14, 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

3 participants