File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
24
24
function startStimulusApp ( context ) {
25
25
var application = _stimulus . Application . start ( ) ;
26
26
27
- application . load ( ( 0 , _webpackHelpers . definitionsFromContext ) ( context ) ) ;
27
+ if ( context ) {
28
+ application . load ( ( 0 , _webpackHelpers . definitionsFromContext ) ( context ) ) ;
29
+ }
28
30
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 ;
31
34
return "continue" ;
32
35
}
33
36
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" ] ) ;
36
41
} ) ;
42
+
43
+ controllerName = _controllerName ;
37
44
} ;
38
45
39
46
for ( var controllerName in _controllers [ "default" ] ) {
You can’t perform that action at this time.
0 commit comments