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

Rollup failed to resolve import "firebase/app" from "resources/js/firebase.js" #23

Open
sumer5020 opened this issue Aug 24, 2022 · 0 comments

Comments

@sumer5020
Copy link

I have vue3 project that use firebase notification, When I moved from MIX to Vite I find this issue:

[vite]: Rollup failed to resolve import "firebase/app" from "resources/js/firebase.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "firebase/app" from "resources/js/firebase.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

my app.js like the following:

import {messaging, token} from "./firebase";

and my firebase.js:

import { initializeApp } from "firebase/app";
import { getMessaging, getToken } from "firebase/messaging";

const firebaseConfig = {
    apiKey: "XXXXXXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXXX",
    authDomain: "XXXXXXXXXX-XXXXXXXXXXX.XXXXXXX.XXX",
    projectId: "XXXXXXXXX-XXXXX",
    storageBucket: "XXXXXXXXXX.XXXXXXXXXx.XXX",
    messagingSenderId: "XXXXXXXXXXXXXXX",
    appId: "X:XXXXXXXXXXXXXX:XXX:XXXXXXXXXXXXXXXXXXXXX",
    measurementId: "X-XXXXXXXXXXXX"
}

// Initialize Firebase
const app = initializeApp(firebaseConfig);

// Initialize Firebase Cloud Messaging and get a reference to the service
export const messaging = getMessaging(app);
export const token = getToken;
export default messaging;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant