From 295011ab632f474cd71f448180d1430cc62dabdd Mon Sep 17 00:00:00 2001 From: Botond Borsits Date: Mon, 31 Jul 2023 21:17:44 +0200 Subject: [PATCH] Add Vue 3 example --- examples/vuejs3/README.md | 29 ++++++++++++++++++ examples/vuejs3/index.html | 13 ++++++++ examples/vuejs3/package.json | 18 +++++++++++ examples/vuejs3/public/favicon.ico | Bin 0 -> 4286 bytes examples/vuejs3/src/App.vue | 9 ++++++ .../vuejs3/src/components/RollbarTest.vue | 16 ++++++++++ examples/vuejs3/src/main.js | 13 ++++++++ examples/vuejs3/src/rollbar.config.js | 13 ++++++++ examples/vuejs3/src/rollbar.js | 17 ++++++++++ examples/vuejs3/vite.config.js | 16 ++++++++++ 10 files changed, 144 insertions(+) create mode 100644 examples/vuejs3/README.md create mode 100644 examples/vuejs3/index.html create mode 100644 examples/vuejs3/package.json create mode 100644 examples/vuejs3/public/favicon.ico create mode 100644 examples/vuejs3/src/App.vue create mode 100644 examples/vuejs3/src/components/RollbarTest.vue create mode 100644 examples/vuejs3/src/main.js create mode 100644 examples/vuejs3/src/rollbar.config.js create mode 100644 examples/vuejs3/src/rollbar.js create mode 100644 examples/vuejs3/vite.config.js diff --git a/examples/vuejs3/README.md b/examples/vuejs3/README.md new file mode 100644 index 00000000..8706d401 --- /dev/null +++ b/examples/vuejs3/README.md @@ -0,0 +1,29 @@ +# vue-project + +This template should help get you started developing with Vue 3 in Vite. + +## Recommended IDE Setup + +[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). + +## Customize configuration + +See [Vite Configuration Reference](https://vitejs.dev/config/). + +## Project Setup + +```sh +npm install +``` + +### Compile and Hot-Reload for Development + +```sh +npm run dev +``` + +### Compile and Minify for Production + +```sh +npm run build +``` diff --git a/examples/vuejs3/index.html b/examples/vuejs3/index.html new file mode 100644 index 00000000..fa6fccca --- /dev/null +++ b/examples/vuejs3/index.html @@ -0,0 +1,13 @@ + + + + + + + Rollbar Vue Example + + +
+ + + diff --git a/examples/vuejs3/package.json b/examples/vuejs3/package.json new file mode 100644 index 00000000..54e03847 --- /dev/null +++ b/examples/vuejs3/package.json @@ -0,0 +1,18 @@ +{ + "name": "vue-project", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "rollbar": "^2.26.2", + "vue": "^3.3.4" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.2.3", + "vite": "^4.4.6" + } +} diff --git a/examples/vuejs3/public/favicon.ico b/examples/vuejs3/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 diff --git a/examples/vuejs3/src/App.vue b/examples/vuejs3/src/App.vue new file mode 100644 index 00000000..303117d9 --- /dev/null +++ b/examples/vuejs3/src/App.vue @@ -0,0 +1,9 @@ + + + diff --git a/examples/vuejs3/src/components/RollbarTest.vue b/examples/vuejs3/src/components/RollbarTest.vue new file mode 100644 index 00000000..dfcfb9d4 --- /dev/null +++ b/examples/vuejs3/src/components/RollbarTest.vue @@ -0,0 +1,16 @@ + + + diff --git a/examples/vuejs3/src/main.js b/examples/vuejs3/src/main.js new file mode 100644 index 00000000..f5756165 --- /dev/null +++ b/examples/vuejs3/src/main.js @@ -0,0 +1,13 @@ +import './assets/main.css'; + +import { createApp } from 'vue'; +import App from './App.vue'; + +import RollbarPlugin from './rollbar'; // Path to your rollbar.js file +import RollbarTest from './components/RollbarTest.vue'; // Path to your RollbarTest.vue file //TESTING + +const app = createApp(App); +app.use(RollbarPlugin); +app.component('RollbarTest', RollbarTest); + +createApp(App).mount('#app'); diff --git a/examples/vuejs3/src/rollbar.config.js b/examples/vuejs3/src/rollbar.config.js new file mode 100644 index 00000000..993c82b2 --- /dev/null +++ b/examples/vuejs3/src/rollbar.config.js @@ -0,0 +1,13 @@ +export default { + accessToken: 'POST_CLIENT_ITEM_ACCESS_TOKEN', + captureUncaught: true, + captureUnhandledRejections: true, + payload: { + environment: 'dev', + client: { + javascript: { + code_version: '1.0.0', + } + } + }, +}; \ No newline at end of file diff --git a/examples/vuejs3/src/rollbar.js b/examples/vuejs3/src/rollbar.js new file mode 100644 index 00000000..0887d9fd --- /dev/null +++ b/examples/vuejs3/src/rollbar.js @@ -0,0 +1,17 @@ +// rollbar.js +import Rollbar from 'rollbar'; +import config from './rollbar.config'; + +const rollbar = new Rollbar(config); + +export default { + install(app) { + app.config.errorHandler = (error, vm, info) => { + rollbar.error(error, { vueComponent: vm, info }); + if (app.config.devtools) { + console.error(error); + } + }; + app.provide('rollbar', rollbar); + }, +}; diff --git a/examples/vuejs3/vite.config.js b/examples/vuejs3/vite.config.js new file mode 100644 index 00000000..5c45e1d9 --- /dev/null +++ b/examples/vuejs3/vite.config.js @@ -0,0 +1,16 @@ +import { fileURLToPath, URL } from 'node:url' + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + ], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } + } +})