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

Installing doesn't work in V3 – callback is not a function #169

Open
ralphjsmit opened this issue Feb 8, 2022 · 6 comments
Open

Installing doesn't work in V3 – callback is not a function #169

ralphjsmit opened this issue Feb 8, 2022 · 6 comments

Comments

@ralphjsmit
Copy link

Hey everyone,

I'm upgrading a project from a colleague to make use of compiling a single JS file with npm modules instead of using several script tags.

I noticed that we're using the $screen helper (and perhaps more :) ), so I updated our app.js file to the following:

import Alpine from 'alpinejs'
import Toolkit from '@alpine-collective/toolkit'

Alpine.plugin(Toolkit)

window.Alpine = Alpine
window.Alpine.start()

Unfortunately every time I try I to use this in the browser, I get the following error in the console:

Schermafbeelding 2022-02-08 om 17 38 32

I tried different Alpine versions, but I'm not sure what could be causing this. Am I importing this wrong?

Thanks!

PS: I also tried opening an issue in the v3 repo, but was redirected here. Don't know if that's on purpose or if you forgot to update the link.

@ralphjsmit ralphjsmit changed the title Installing doesn't work in V3 Installing doesn't work in V3 – callback is not a function Feb 8, 2022
@SimoTod
Copy link
Collaborator

SimoTod commented Feb 8, 2022

Thanks for the heads up. I'll have a look tomorrow. P.s. If you only need $screen, you can try to install only that helper.

@ralphjsmit
Copy link
Author

Thanks! Could you point me to some documentation or sth about installing the screen and scroll helper?

(It was quite difficult via Google/npm to find the right repo(s) with the correct version and documentation..)

@SimoTod
Copy link
Collaborator

SimoTod commented Feb 9, 2022

@ralphjsmit
Copy link
Author

Awesome man, that works! Thanks! Didn't figure out that the names in the table of the main readme were clickable🤯

I installed the plugins and everything works now, so you could close this issue (or keep it open if you want to doublecheck the above issue).

@SimoTod
Copy link
Collaborator

SimoTod commented Feb 9, 2022

👍 I'll keep it open for now

@drdogbot7
Copy link

drdogbot7 commented Mar 24, 2022

This seems to be an issue with the Interval plugin. I can import all of the other packages without any errors.

import Alpine from 'alpinejs';
import Dbg from '@alpine-collective/toolkit-dbg';
import Range from '@alpine-collective/toolkit-range';
import Screen from '@alpine-collective/toolkit-screen';
import Scroll from '@alpine-collective/toolkit-scroll';
import Truncate from '@alpine-collective/toolkit-truncate';

Alpine.plugin(Dbg);
Alpine.plugin(Range);
Alpine.plugin(Screen);
Alpine.plugin(Scroll);
Alpine.plugin(Truncate);

Alpine.start();

… but I get errors when I try to import the whole toolkit or just Inverval

import Alpine from 'alpinejs';
import Interval from '@alpine-collective/toolkit-interval';

Alpine.plugin(Interval);

Alpine.start();

ERROR: Uncaught TypeError: callback is not a function

import Alpine from 'alpinejs';
import Toolkit from '@alpine-collective/toolkit';

Alpine.plugin(Toolkit);

Alpine.start();

ERROR: Uncaught TypeError: callback is not a function

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

3 participants