Updated symfony/stimulus-bridge recipe

This commit is contained in:
Jan Böhmer 2023-06-11 19:58:31 +02:00
parent 52c8ea13af
commit 7658cfcdbd
3 changed files with 12 additions and 5 deletions

3
assets/bootstrap.js vendored
View file

@ -4,8 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
/\.[jt]sx?$/
));
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

View file

@ -672,9 +672,14 @@
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.8",
"ref": "9e33a8a3794b603fb4be6c04ee5ecab901ce549e"
}
"version": "2.9",
"ref": "05c45071c7ecacc1e48f94bc43c1f8d4405fb2b2"
},
"files": [
"./assets/bootstrap.js",
"./assets/controllers.json",
"./assets/controllers/hello_controller.js"
]
},
"symfony/stopwatch": {
"version": "v4.2.3"

View file

@ -71,6 +71,9 @@ Encore
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()