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

Unable to import rollbar module in TypeScript web application (Vue 3) #1148

Open
MathBeaudoin opened this issue Jan 7, 2025 · 1 comment

Comments

@MathBeaudoin
Copy link

I followed the documentation to integrate Rollbar into my web application.

After adding the Rollbar plugin to my Vue application, I am always given the following error (note that I am using ESNext):

Loading failed for the module with source “http://localhost:5173/node_modules/.vite/deps/rollbar.js?v=1d483b56”.

Steps taken

  1. (rollbar.ts) I have followed the TypeScript steps to import Rollbar and create the Rollbar instance:
import { App } from "vue";
import Rollbar from "rollbar";

const rollbar = new Rollbar({
    accessToken: 'myToken',
    captureUncaught: true,
    captureUnhandledRejections: true
});

export const RollbarPlugin =  {
    install(app: App) {
        app.config.errorHandler = (error: any, instance, info) => {
            console.log("error");
            rollbar.error(error, { vueComponent: instance, info });
        };

        app.provide('rollbar', rollbar);
    },
};
  1. (main.ts) I have correctly added the RollbarPlugin to my application:
import { RollbarPlugin } from "@/rollbar";

const app = createApp(App);
app.use(RollbarPlugin);
Copy link

linear bot commented Jan 7, 2025

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