question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sourcemap error when importing firebase/auth

See original GitHub issue

Describe the bug

When importing firebase/auth, receiving errors with ESM compatible library. Have no issues with other parts of the library, firebase/app, firebase/firestore, etc.

Error: ENOENT: no such file or directory, stat '/Users/server/Projects/firebase-example/node_modules/@firebase/auth/dist/

It seems all the correct files are in place. Screen Shot 2020-11-06 at 11 40 31 AM

Reproduction

https://github.com/mahlm/firebase-example

$ yarn create vite-app firebase-example
$ cd firebase-example
$ yarn add firebase
$ yarn

// in App.vue, add:
import firebase from 'firebase/app'
import 'firebase/auth'

$ yarn dev

System Info

  • required vite version: v1.0.0-rc.9
  • required Operating System: Windows + OSX
  • required Node version: v12.14.0

Logs (Optional if provided reproduction)

$ vite --debug
vite v1.0.0-rc.9
  vite:config env mode: development +0ms
  vite:config env: {} +1ms
  vite:optimize Hash is consistent. Skipping. Use --force to override. +0ms

  Dev server running at:
  > Local:    http://localhost:3000/
  > Network:  http://192.168.1.245:3000/

  vite:server server ready in 247ms. +0ms
  vite:hmr         / imports /src/main.js +0ms
  vite:rewrite (skipped) / +0ms
  vite:history redirecting /auth to /index.html +0ms
  vite:rewrite /auth: serving from cache +0ms
  vite:rewrite (skipped) /auth +13ms
  vite:rewrite /src/main.js: rewriting +34ms
  vite:rewrite     "vue" --> "/@modules/vue.js" +1ms
  vite:hmr         /src/main.js imports /@modules/vue.js +49ms
  vite:rewrite     "./App.vue" --> "/src/App.vue" +1ms
  vite:hmr         /src/main.js imports /src/App.vue +1ms
  vite:rewrite     "./index.css" --> "/src/index.css?import" +0ms
  vite:hmr         /src/main.js imports /src/index.css +0ms
  vite:rewrite (skipped) /vite/client +26ms
  vite:resolve (optimized) vue.js -> node_modules/.vite_opt_cache/vue.js +0ms
  vite:rewrite /@modules/vue.js: no imports found. +11ms
  vite:sfc /Users/server/Projects/firebase-example/src/App.vue parsed in 7ms. +0ms
  vite:rewrite /src/App.vue: rewriting +24ms
  vite:resolve (node_module entry) firebase/app -> dist/index.esm.js +0ms
  vite:rewrite     "firebase/app" --> "/@modules/firebase/app/dist/index.esm.js" +1ms
  vite:hmr         /src/App.vue imports /@modules/firebase/app/dist/index.esm.js +63ms
  vite:resolve (node_module entry) firebase/auth -> dist/index.esm.js +1ms
  vite:rewrite     "firebase/auth" --> "/@modules/firebase/auth/dist/index.esm.js" +2ms
  vite:hmr         /src/App.vue imports /@modules/firebase/auth/dist/index.esm.js +1ms
  vite:rewrite     "./components/HelloWorld.vue" --> "/src/components/HelloWorld.vue" +0ms
  vite:hmr         /src/App.vue imports /src/components/HelloWorld.vue +0ms
  vite:resolve failed to resolve package.json for firebase/app/dist/index.esm.js +15ms
  vite:resolve (node_modules) firebase/app/dist/index.esm.js -> node_modules/firebase/app/dist/index.esm.js +52ms
  vite:resolve failed to resolve package.json for firebase/auth/dist/index.esm.js +8ms
  vite:resolve (node_modules) firebase/auth/dist/index.esm.js -> node_modules/firebase/auth/dist/index.esm.js +7ms
  vite:hmr ws client connected +29ms
  vite:sfc /Users/server/Projects/firebase-example/src/App.vue parse cache hit +52ms
  vite:sfc /src/App.vue template compiled in 16ms. +17ms
  vite:rewrite /src/App.vue?type=template: rewriting +51ms
  vite:rewrite     "vue.js" --> "/@modules/vue.js" +1ms
  vite:hmr         /src/App.vue?type=template imports /@modules/vue.js +23ms
  vite:rewrite /@modules/firebase/app/dist/index.esm.js: rewriting +7ms
  vite:resolve (node_module entry) @firebase/app -> dist/index.esm.js +39ms
  vite:rewrite     "@firebase/app" --> "/@modules/@firebase/app/dist/index.esm.js" +2ms
  vite:hmr         /@modules/firebase/app/dist/index.esm.js imports /@modules/@firebase/app/dist/index.esm.js +9ms
  vite:rewrite     "@firebase/app" --> "/@modules/@firebase/app/dist/index.esm.js" +0ms
  vite:hmr         /@modules/firebase/app/dist/index.esm.js imports /@modules/@firebase/app/dist/index.esm.js +0ms
  vite:rewrite /@modules/firebase/auth/dist/index.esm.js: rewriting +3ms
  vite:resolve (node_module entry) @firebase/auth -> dist/auth.esm.js +4ms
  vite:rewrite     "@firebase/auth" --> "/@modules/@firebase/auth/dist/auth.esm.js" +1ms
  vite:hmr         /@modules/firebase/auth/dist/index.esm.js imports /@modules/@firebase/auth/dist/auth.esm.js +5ms
  vite:sfc /Users/server/Projects/firebase-example/src/components/HelloWorld.vue parsed in 5ms. +21ms
  vite:rewrite /src/components/HelloWorld.vue: rewriting +10ms
  vite:rewrite     nothing needs rewriting. +0ms
  vite:resolve failed to resolve package.json for @firebase/app/dist/index.esm.js +11ms
  vite:resolve (node_modules) @firebase/app/dist/index.esm.js -> node_modules/@firebase/app/dist/index.esm.js +55ms
  vite:resolve failed to resolve package.json for @firebase/auth/dist/auth.esm.js +13ms
  vite:resolve (node_modules) @firebase/auth/dist/auth.esm.js -> node_modules/@firebase/auth/dist/auth.esm.js +11ms
  vite:sfc /Users/server/Projects/firebase-example/src/components/HelloWorld.vue parse cache hit +19ms
  vite:sfc /src/components/HelloWorld.vue template compiled in 8ms. +8ms
  vite:rewrite /src/components/HelloWorld.vue?type=template: rewriting +24ms
  vite:rewrite     "vue.js" --> "/@modules/vue.js" +1ms
  vite:hmr         /src/components/HelloWorld.vue?type=template imports /@modules/vue.js +34ms
  vite:rewrite /@modules/@firebase/app/dist/index.esm.js: rewriting +3ms
  vite:resolve (node_module entry) tslib -> tslib.es6.js +15ms
  vite:rewrite     "tslib" --> "/@modules/tslib/tslib.es6.js" +2ms
  vite:hmr         /@modules/@firebase/app/dist/index.esm.js imports /@modules/tslib/tslib.es6.js +5ms
  vite:resolve (node_module entry) @firebase/util -> dist/index.esm.js +1ms
  vite:rewrite     "@firebase/util" --> "/@modules/@firebase/util/dist/index.esm.js" +0ms
  vite:hmr         /@modules/@firebase/app/dist/index.esm.js imports /@modules/@firebase/util/dist/index.esm.js +1ms
  vite:resolve (node_module entry) @firebase/component -> dist/index.esm.js +1ms
  vite:rewrite     "@firebase/component" --> "/@modules/@firebase/component/dist/index.esm.js" +1ms
  vite:hmr         /@modules/@firebase/app/dist/index.esm.js imports /@modules/@firebase/component/dist/index.esm.js +0ms
  vite:resolve (node_module entry) @firebase/logger -> dist/index.esm.js +1ms
  vite:rewrite     "@firebase/logger" --> "/@modules/@firebase/logger/dist/index.esm.js" +1ms
  vite:hmr         /@modules/@firebase/app/dist/index.esm.js imports /@modules/@firebase/logger/dist/index.esm.js +1ms
  vite:rewrite /@modules/@firebase/auth/dist/auth.esm.js: rewriting +11ms
  vite:resolve (node_module entry) @firebase/app -> dist/index.esm.js +12ms
  vite:rewrite     "@firebase/app" --> "/@modules/@firebase/app/dist/index.esm.js" +2ms
  vite:hmr         /@modules/@firebase/auth/dist/auth.esm.js imports /@modules/@firebase/app/dist/index.esm.js +13ms
  vite:resolve failed to resolve package.json for tslib/tslib.es6.js +29ms
  vite:resolve (node_modules) tslib/tslib.es6.js -> node_modules/tslib/tslib.es6.js +60ms
  vite:resolve failed to resolve package.json for @firebase/util/dist/index.esm.js +1ms
  vite:resolve (node_modules) @firebase/util/dist/index.esm.js -> node_modules/@firebase/util/dist/index.esm.js +1ms
  vite:resolve failed to resolve package.json for @firebase/component/dist/index.esm.js +2ms
  vite:resolve (node_modules) @firebase/component/dist/index.esm.js -> node_modules/@firebase/component/dist/index.esm.js +2ms
  vite:resolve failed to resolve package.json for @firebase/logger/dist/index.esm.js +3ms
  vite:resolve (node_modules) @firebase/logger/dist/index.esm.js -> node_modules/@firebase/logger/dist/index.esm.js +3ms
  vite:rewrite /@modules/tslib/tslib.es6.js: no imports found. +36ms
  vite:rewrite /@modules/@firebase/util/dist/index.esm.js: rewriting +11ms
  vite:resolve (node_module entry) tslib -> tslib.es6.js +20ms
  vite:rewrite     "tslib" --> "/@modules/tslib/tslib.es6.js" +7ms
  vite:hmr         /@modules/@firebase/util/dist/index.esm.js imports /@modules/tslib/tslib.es6.js +54ms
  vite:rewrite /@modules/@firebase/component/dist/index.esm.js: rewriting +27ms
  vite:resolve (node_module entry) tslib -> tslib.es6.js +30ms
  vite:rewrite     "tslib" --> "/@modules/tslib/tslib.es6.js" +3ms
  vite:hmr         /@modules/@firebase/component/dist/index.esm.js imports /@modules/tslib/tslib.es6.js +30ms
  vite:resolve (node_module entry) @firebase/util -> dist/index.esm.js +1ms
  vite:rewrite     "@firebase/util" --> "/@modules/@firebase/util/dist/index.esm.js" +1ms
  vite:hmr         /@modules/@firebase/component/dist/index.esm.js imports /@modules/@firebase/util/dist/index.esm.js +1ms
  vite:rewrite /@modules/@firebase/logger/dist/index.esm.js: no imports found. +9ms
  vite:rewrite (skipped) /src/index.css?import +6ms
  vite:resolve failed to resolve package.json for firebase/app/dist/index.esm.js.map +35ms
  vite:resolve (node_modules) firebase/app/dist/index.esm.js.map -> node_modules/firebase/app/dist/index.esm.js.map +88ms
  vite:resolve failed to resolve package.json for @firebase/app/dist/index.esm.js.map +4ms
  vite:resolve (node_modules) @firebase/app/dist/index.esm.js.map -> node_modules/@firebase/app/dist/index.esm.js.map +2ms
  vite:resolve failed to resolve package.json for @firebase/util/dist/index.esm.js.map +3ms
  vite:resolve (node_modules) @firebase/util/dist/index.esm.js.map -> node_modules/@firebase/util/dist/index.esm.js.map +3ms
  vite:resolve failed to resolve package.json for @firebase/component/dist/index.esm.js.map +3ms
  vite:resolve (node_modules) @firebase/component/dist/index.esm.js.map -> node_modules/@firebase/component/dist/index.esm.js.map +3ms
  vite:resolve failed to resolve package.json for @firebase/logger/dist/index.esm.js.map +2ms
  vite:resolve (node_modules) @firebase/logger/dist/index.esm.js.map -> node_modules/@firebase/logger/dist/index.esm.js.map +2ms
  vite:resolve failed to resolve package.json for @firebase/auth/dist/auth.esm.js.map +2ms
  vite:resolve (node_modules) @firebase/auth/dist/auth.esm.js.map -> node_modules/@firebase/auth/dist/auth.esm.js.map +2ms
  vite:rewrite (skipped) /@modules/firebase/app/dist/index.esm.js.map +40ms
  vite:rewrite (skipped) /@modules/@firebase/app/dist/index.esm.js.map +2ms
  vite:rewrite (skipped) /@modules/@firebase/util/dist/index.esm.js.map +3ms
  vite:rewrite (skipped) /@modules/@firebase/component/dist/index.esm.js.map +2ms
  vite:rewrite (skipped) /@modules/@firebase/logger/dist/index.esm.js.map +1ms
  vite:resolve failed to resolve package.json for firebase/auth/dist/index.esm.js.map +17ms
  vite:resolve (node_modules) firebase/auth/dist/index.esm.js.map -> node_modules/firebase/auth/dist/index.esm.js.map +17ms
  vite:rewrite (skipped) /@modules/firebase/auth/dist/index.esm.js.map +5ms
  vite:rewrite (skipped) /src/assets/logo.png +5ms

  Error: ENOENT: no such file or directory, stat '/Users/server/Projects/firebase-example/node_modules/@firebase/auth/dist/ [synthetic:util/defineproperty] '
      at Object.statSync (fs.js:915:3)
      at Object.statSync (/Users/server/Projects/firebase-example/node_modules/graceful-fs/polyfills.js:308:16)
      at cachedRead (/Users/server/Projects/firebase-example/node_modules/vite/src/node/utils/fsUtils.ts:33:27)
      at /Users/server/Projects/firebase-example/node_modules/vite/src/node/utils/fsUtils.ts:65:40
      at Array.map (<anonymous>)
      at cachedRead (/Users/server/Projects/firebase-example/node_modules/vite/src/node/utils/fsUtils.ts:62:21)
      at serve (/Users/server/Projects/firebase-example/node_modules/vite/src/node/server/serverPluginModuleResolve.ts:42:7)
      at /Users/server/Projects/firebase-example/node_modules/vite/src/node/server/serverPluginHtml.ts:69:5
      at /Users/server/Projects/firebase-example/node_modules/vite/src/node/server/serverPluginModuleRewrite.ts:55:5
      at /Users/server/Projects/firebase-example/node_modules/vite/src/node/server/serverPluginSourceMap.ts:32:5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
guillenotfoundcommented, Nov 26, 2020

Same here, does someone found a solution?

1reaction
adapapcommented, Nov 12, 2020

Hi, running into this issue still. Potential solution using Webpack is here: https://stackoverflow.com/questions/62694558/firebase-auth-import-source-map-warnings

I was wondering if I could do the equivalent in Rollup. I tried to use output.sourcemap and output.sourcemapExcludeSources and neither one fixes the error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase/auth import source-map warnings - Stack Overflow
js): Failed to parse source map from 'D:\Projects\DeparturesSchedule\node_modules\@firebase\auth\dist\ [synthetic:util\global] ' file: Error: ...
Read more >
Failed to parse source map from 'C:\' file: Error - YouTube
greetings, this is slu channel we will handle the Failed to parse source map from 'C:\' file: Error : ENOENT: no such file...
Read more >
Firebase JavaScript SDK Release Notes - Google
Fixed a bug that caused crashes in Cloud Storage, Cloud Functions for Firebase Client SDK, and Realtime Database when using the all-in-one firebase...
Read more >
Compile error in firebase web3 auth - Moralis Forum
node_modules/@moralisweb3/client-firebase-auth-utils/lib/index.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed ...
Read more >
export 'auth' (imported as 'firebase') was not found ... - You.com
Attempted import error: 'auth' is not exported from 'firebase/auth' ; { initializeApp } from 'firebase/app'; ; const firebaseConfig = { ; const app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found