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

Not working with @hotwired/stimulus 3.0.0 #12

Closed
elalemanyo opened this issue Sep 28, 2021 · 14 comments
Closed

Not working with @hotwired/stimulus 3.0.0 #12

elalemanyo opened this issue Sep 28, 2021 · 14 comments

Comments

@elalemanyo
Copy link

Hi,
The hotkeys was working perfectly with stimulus 2, but stop working after we did the update. Not getting any error, just hotkeys stop working. Any help?

Thanks!

@leastbad
Copy link
Owner

Thanks for the heads-up and I'm sorry that you're having troubles.

You are importing from stimulus and not @hotwired/stimulus, right?

@leastbad
Copy link
Owner

I just re-read the subject heading. You need to adjust the package that you import from. You can upgrade without changing packages.

@marcoroth what's the status on the webpack helpers?

@elalemanyo
Copy link
Author

This is how my code looks like

import { Application } from '@hotwired/stimulus';
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers';
import Hotkeys from 'stimulus-hotkeys';

application.register('hotkeys', Hotkeys);

Or are you asking something different?

@leastbad
Copy link
Owner

In your package.json, bring in the stimulus package at v3.

import { Application } from 'stimulus'

Keep the webpack helpers exactly as you have them.

@elalemanyo
Copy link
Author

hmm, to do the update I was following this: https://gist.github.com/adrienpoly/6b4f2531e043fd45f9ddea305767c13a
Sure about importing from stimulus?

@elalemanyo
Copy link
Author

I think we need to change this line:

import { Controller } from 'stimulus'

@leastbad
Copy link
Owner

100% sure. There's no need to break the entire ecosystem of existing controllers, both published and in our apps.

That's why the stimulus package has a v3.

@elalemanyo
Copy link
Author

Not sure why but is not working for me. I have v3 in my package, but if I change to import from stimulus I get an error:
Module not found: Error: Can't resolve 'stimulus'
Maybe I am doing something wrong 🤷‍♂️

@marcoroth
Copy link
Contributor

@leastbad I think you need to bump this:

"stimulus": "^2.0.0"

to either >= 2.0.0 or ^3.0.0

@elalemanyo
Copy link
Author

/pull/13
Not sure if it is good enough, but works for me 😀

@leastbad
Copy link
Owner

Thanks Marco! I'm AFK until later tonight but I will bump as you suggest.

@elalemanyo I am sorry that we're having this conversation when I'm away from my computer because it's much harder for me to paste what you need, much less make real changes.

The big picture on this situation is that it's really unfortunate that we have to have this conversation at all - but here we are.

None of my libraries, including StimulusReflex, are going to be switching to the new package name because we're not planning to contribute to the problem. What you have to understand is that to change package names is to break every existing deployment, every project that relies on it. It also means that you're going to end up including Stimulus in your pack twice, once with each name. Again, it's a dumb nightmare scenario that we worked very hard to prevent.

hotwired/stimulus#421 (comment)

If you can just be patient and wait until tonight, I will push a version that bumps the acceptable stimulus version.

@elalemanyo
Copy link
Author

Thanks Marco! I'm AFK until later tonight but I will bump as you suggest.

@elalemanyo I am sorry that we're having this conversation when I'm away from my computer because it's much harder for me to paste what you need, much less make real changes.

The big picture on this situation is that it's really unfortunate that we have to have this conversation at all - but here we are.

None of my libraries, including StimulusReflex, are going to be switching to the new package name because we're not planning to contribute to the problem. What you have to understand is that to change package names is to break every existing deployment, every project that relies on it. It also means that you're going to end up including Stimulus in your pack twice, once with each name. Again, it's a dumb nightmare scenario that we worked very hard to prevent.

hotwired/stimulus#421 (comment)

If you can just be patient and wait until tonight, I will push a version that bumps the acceptable stimulus version.

@leastbad thanks for the explanation. Of course I can wait! Don't stress out 😊

@Abbe91
Copy link

Abbe91 commented Sep 29, 2021

I have the same problem. It worked yesterday but not today

@leastbad
Copy link
Owner

Thank-you for your patience. [email protected] has been released. It supports any version of the stimulus import 2 or later.

As previously stated, you should not switch to the @hotwired/stimulus package if you have been using stimulus previously. There is no advantage to switching. See my explanation here.

Feel welcome to come to our Discord if you need any help getting your project working with Stimulus 3.

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

4 participants