Stimulus 2 TypeError: undefined is not an object (evaluating 'Object.keys(valueDescriptorMap)

Hi, following Stimulus 2 upgrade I’m getting the following error:

Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'Object.keys(valueDescriptorMap)')

when importing a controller from another package such as:

import FlashController from "stimulus-flash"
application.register("flash", FlashController)

If I load the same controller from app/javascript/controllers it works fine.
The following method raises.

./node_modules/@stimulus/core/dist/application.js
function(step(op))
if (op[0] & 5) throw op[1];

I’m using Rails and webpack is compiling it all fine.
No idea where to check so far. Any recommendations?

var t=require("stimulus");module.exports=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i,r=o.prototype;return r.connect=function(){this.autohide&&this.setInterval()},r.initialize=function(){this.delay=this.delayConfig,this.autohide=this.autohideConfig},r.setInterval=function(){var t=this;setTimeout(function(){t.close()},this.delay)},r.close=function(){var t=this;this.stopInterval(),this.element.style.opacity="0",setTimeout(function(){t.element.remove()},300)},r.disconnect=function(){this.stopInterval()},r.stopInterval=function(){clearTimeout(this.setInterval)},(i=[{key:"delayConfig",get:function(){return parseInt(this.data.get("delay"))||2e3}},{key:"autohideConfig",get:function(){return"false"!=this.data.get("autohide")}}])&&function(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}(o.prototype,i),o}(t.Controller);

We have seen similar error messages with a package that had Stimulus 1.1 linked as a dependency (not peerDependency)

Merci Adrien.
Still don’t know why this change is needed and what it’s doing actually but that’s for another day.

I just got around to upgrading to stimulus 2.0 and everything worked fine except stimulus-autocomplete. I upgraded it when I found you helped identify their problem,

I now have another problem Getting stimulus error on pages using stimulus autocomplete · Issue #48 · afcapel/stimulus-autocomplete · GitHub. Don’t know if this is related to dataset or if someone else has posted something similar.

UPDATE:
Guess I can call this User error. I deployed my site to my staging server and everything worked!!

Apparently the web pack development server was not picking up js changes. I swear I had restarted both rails and development server, but I just quit my shell and restarted and the stimulus-autocomplete update worked.