Closed elalemanyo closed 2 years ago
Thanks for the heads-up and I'm sorry that you're having troubles.
You are importing from stimulus
and not @hotwired/stimulus
, right?
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?
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?
In your package.json, bring in the stimulus package at v3.
import { Application } from 'stimulus'
Keep the webpack helpers exactly as you have them.
hmm, to do the update I was following this: https://gist.github.com/adrienpoly/6b4f2531e043fd45f9ddea305767c13a Sure about importing from stimulus?
I think we need to change this line: https://github.com/leastbad/stimulus-hotkeys/blob/d65791644a62a93e657e752388686ac62d147474/src/index.js#L1
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.
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 🤷♂️
@leastbad I think you need to bump this:
to either >= 2.0.0
or ^3.0.0
/pull/13 Not sure if it is good enough, but works for me 😀
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.
https://github.com/hotwired/stimulus/pull/421#issuecomment-908609584
If you can just be patient and wait until tonight, I will push a version that bumps the acceptable stimulus version.
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 😊
I have the same problem. It worked yesterday but not today
Thank-you for your patience. stimulus-hotkeys@1.0.5
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.
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!