symfony / stimulus-bridge

Stimulus integration bridge for Symfony projects
https://symfony.com/ux
75 stars 15 forks source link

"@symfony/stimulus-bundle" module not found #88

Closed koredalin closed 5 months ago

koredalin commented 8 months ago

Hello, Symfony Team, I'm trying to install webpack on Symfony 7. I'm using these lessons tutorial "https://symfonycasts.com/screencast/symfony/webpack-encore-usage". I tried also this tutorial: "https://symfonycasts.com/screencast/asset-mapper/stimulus" to instal Stimulus bundle. The asset map looks pretty good to me but I still get an error: "Module build failed: Module not found: "./assets/bootstrap.js" contains a reference to the file "@symfony/stimulus-bundle". This file can not be found, please check it for typos or update it if the file got moved.". I'm attaching you some pictures with the the issue and the code. I've tried so many ways to resolve the issue but I still have no dicision. Please, have a look and write me some fine answer back.

Thank you. Best Regards. Hristo Hristov

image

image

image

image

image

koredalin commented 8 months ago

Ok, I've read that I should install @symfony/stimulus-bridge first. I did it. Somehow the app was buided. But now I have new error. As you can see - the Bridge library is still not loaded right. I suppose that the css files are loaded but the system tries to load them a second time in all.css file. The files are loaded in " http://127.0.0.1:8000/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_symfony_ux-turbo_dist-f44c0f.css" file. But the system tries to load them like " http://127.0.0.1:8000/assets/styles/~@fortawesome/fontawesome-free/css/all.css" too.

I'm adding some pictures. So, you can understand what I'm doing.

image

image

image

image

image

I don't know what I can do more. Please, help me.

Thank you. Hristo Hristov

David-Moisan commented 5 months ago

Hi @koredalin, I have the same problem as you.

I searched the web and found this tip:

In your file assets/bootsrap.js :

import { startStimulusApp } from "@symfony/stimulus-bundle";
export const app = startStimulusApp();

Delete all "require.context" and change stimulus-bridge by stimulus-bundle

Before compile your assets check if you have stimulus-bundle in importmap.php And compile your asset mapper

koredalin commented 5 months ago

Thank you, @David-Moisan, I have found that there is a typo in my code. Or sth like that. It was 2 months ago. I have started symfonycasts.com tutorials from the same begining. I don't remember what exactly was the issue. However, I used the stimulus-bridge at the end. If you are curious - you can review my code on: https://github.com/koredalin/symfony-dent-calendar or https://github.com/koredalin/symfony-test-vinyl One of these 2 repositories is fixed and working. :-)

Best Regards and Thank you, once again!

kbond commented 5 months ago

I think this issue can be closed but @koredalin, let me know if you want me to reopen.