Skip to content

Commit c727a28

Browse files
authored
Merge pull request #13 from chapterjason/bugfix/old-dist
Update dist
2 parents 1244a25 + 758aa5c commit c727a28

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

dist/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
2424
function startStimulusApp(context) {
2525
var application = _stimulus.Application.start();
2626

27-
application.load((0, _webpackHelpers.definitionsFromContext)(context));
27+
if (context) {
28+
application.load((0, _webpackHelpers.definitionsFromContext)(context));
29+
}
2830

29-
var _loop = function _loop(controllerName) {
30-
if (!_controllers["default"].hasOwnProperty(controllerName)) {
31+
var _loop = function _loop(_controllerName) {
32+
if (!_controllers["default"].hasOwnProperty(_controllerName)) {
33+
controllerName = _controllerName;
3134
return "continue";
3235
}
3336

34-
_controllers["default"][controllerName].then(function (module) {
35-
application.register(controllerName, module["default"]);
37+
_controllers["default"][_controllerName].then(function (module) {
38+
// Normalize the controller name: remove the initial @ and use Stimulus format
39+
_controllerName = _controllerName.substr(1).replace(/_/g, "-").replace(/\//g, "--");
40+
application.register(_controllerName, module["default"]);
3641
});
42+
43+
controllerName = _controllerName;
3744
};
3845

3946
for (var controllerName in _controllers["default"]) {

0 commit comments

Comments
 (0)