import Tribute from 'tributejs';
window.Tribute = Tribute;
But it doesn't want to load, and I'm getting an error when I try to run npm run build in terminal.
failed to load config from C:\Users\m\Staff-Collab\vite.config.js
error during build:
ReferenceError: window is not defined
at C:\Users\m\Staff-Collab\node_modules\tributejs\dist\tribute.js:98:3
at C:\Users\m\Staff-Collab\node_modules\tributejs\dist\tribute.js:2:83
at Object.<anonymous> (C:\Users\m\Staff-Collab\node_modules\tributejs\dist\tribute.js:5:2)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object._require.extensions.<computed> [as .js] (file:///C:/Users/m/Staff-Collab/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:63157:17)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
Can me anayone help with the missing part?
I know it is probably something stupid I did wrong.. But What??
Actually solved it, I missed something in my vite config.
But now I'm still getting no live Tribute instance in the console.
And alpine is throwing on my an error that - Tribute is not defined
Any suggestion?
@Dave Wize that looks default. Weird that you got that error in the first place? How are you calling tribune? In code or the browser console? And you said alpinejs throws an error, yet you don't seem to be using that at all?
@Sinnbeck That first error was because I tried to debug why the tribute was not defined, and I messed up the vite config, so I reverted it to the previous state.
@Sinnbeck I'm unsure how alpine works in general, (I'm still learning this nice technology), but I thought that it is bieng new'd up when you do the x-data.
In any case I did run tribute = new Tribute in the browser console after full page load and reieved the same error that tribute is not defined.
Actually you seem to be right (as always), moving it up did worked I jsut needed to npm run build for the change to take affect.
Thank you @sinnbeck your the best:)