Duplicate controller instantiation when using hot module replacement

Oh my, it might be hard to extract out, but here’s my context:

I started with a fresh copy of Sage 9.0.0, a webpack-based Wordpress theme starter (see their build dir for the webpack config).

I swapped in babel instead of buble and configured babel to include everything I needed.

In resources/assets/scripts/main.js, I’m importing the autoload/_stimulus.js definition file above, and added a ../controllers/ directory for my controllers relative to autoload/.

1 Like