Closed jvanoostrom closed 3 years ago
Hi, I have exactly the same issue :/ build work in dev but not in prod. If you find anything, please let us know
Ok I found a solution to my problem. The folder controllers
was missing.
Initialy it has been created here ./assets/controllers
, so I created ./assets/js/controllers
to fit my app architecture.
Hi!
About the original error. Your bootstrap.js
file correctly looks like this:
// assets/bootstrap.js
import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
));
And the error is:
"./assets/bootstrap.js" contains a reference to the file "./controllers".
That ./controllers
part comes from the END of the long '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
line. Everything in front of the !
is fancy "loader" magic. What this line "basically" is doing is looking for a controllers
directory next to the bootstrap.js
file (so assets/controllers
). Double check that it's there :).
Cheers!
Hi all,
I'm trying to get stimulus to work together with the Bolt CMS (link), which is a Symfony application. I've created some custom code to run along Bolt, for which I also added webpack encore. I've created a build in webpack_encore.yaml.
Now, following the installation steps of Encore and Stimulus, encore throws me a build error:
My bootstrap.js contains the exact code from the stimulus guide:
My webpack.config.js:
My webpack_encore.yaml:
And finally my assets.yaml:
Like said, it throws me an error. I've followed the exact same steps on a fresh symfony install, and I noticed 2 things:
Anyone has any idea?
Thanks in advance!
Jeffrey