0
  • My Vue project used Firebase Auth for sign in and sign up but when added firebase package to project, it show blank page on ie11. Firebase and Vue Cli Plugin Babel package:
"firebase": "9.6.1",
"@vue/cli-plugin-babel": "4.4.4"
  • Babel config:
module.exports = {
    presets: [['@vue/app', { useBuiltIns: 'entry' }]]
}

Thanks

2
  • Are there any error messages in the console? As far as I know, IE11 doesn't support ES6 syntax, you may need Babel to transpile it to ES5 for it to work. It would be helpful if you could provide a complete code example to reproduce this issue. In addition, IE will end support soon, so I suggest you focus more on modern browsers like Chrome, Microsoft Edge. Commented Feb 22, 2022 at 7:46
  • sorry, I resolved this bug but I didn't understand this problem.
    – MrXo
    Commented Mar 22, 2022 at 5:02

1 Answer 1

1

I read Firebase docs in here: https://firebase.google.com/docs/web/environments-js-sdk#suggested-polyfills. I resolved this problem as follow:

  • babel.config.js:
module.exports = {
  presets: [['@vue/app', { useBuiltIns: 'entry' }]]
}
  • In main.js
import 'core-js/stable'
import 'cross-fetch/polyfill'
import 'indexeddb-getall-shim'
  • In Package.json: Add more pakage:
"cross-fetch": "^3.1.5"
"core-js": "3.6.5",
"indexeddb-getall-shim": "^1.3.6"
  • In vue.config.js:

transpileDependencies: [

// can be string or regex

'@firebase',

/graphql/ ]

But i still don't understand the problem.

2
  • 1
    IE11 is a very old browser that lacks many new javascript features and syntax. So when it tries to load your app it doesn't understand the code and can't run it. To remedy that you need two things, polyfills that acts as the missing APIs (though some times with limitations) and a transpiler that downgrades any new syntax to something IE11 understands (in most cases this is babel). What you added here is a polyfill for fetch and some other stuff (via core-js) and you told the vue scripts to transpile the firebase package for you so that IE11 can understand its syntax. Commented Mar 22, 2022 at 5:20
  • Thanks for posting the solution for this issue. You can mark your answer as an accepted answer after 48 hrs, when it is available to mark. It can help other community members in future in similar kind of issues. Thanks for your understanding. Commented Mar 22, 2022 at 8:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.