Я изучаю Symfony по курсу «Обучение ENI» «Научитесь разрабатывать веб-приложения с помощью PHP и Symfony (2-е издание)», автор: Ив РОКАМОРА.
В разделе «Webpack Encore» он объясняет, как использовать Sass и Vue.js для предварительной обработки CSS и Javascript.
Однако Я не могу заставить Webpack-Encore работать вместе с Bootstrap.
Проблема
- Я использовалto create the structure of the application.
Код: Выделить всё
symfony new --webapp - Then, to install Webpack Encore.
Код: Выделить всё
composer require symfony/webpack-encore-bundle - I installed ,
Код: Выделить всё
sass-loaderandКод: Выделить всё
node-sasswithКод: Выделить всё
bootstrap.Код: Выделить всё
npmreturns a clean installation.Код: Выделить всё
npm install - I did modify webpack.config.js to enable Sass loader.
Код: Выделить всё
npm run watchКод: Выделить всё
ERROR Failed to compile with 1 errors 9:54:06
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.
Код: Выделить всё
npm run watchWhat I tried
First of all, I tried using composer to install the missing package, but it appears that stimulus-bundle is part of Webpack-Encore, and it already is on my project.
I noticed that the guide had a different
Код: Выделить всё
package.jsonКод: Выделить всё
@hotwired/stimulusКод: Выделить всё
@symfony/stimulus-bridgeКод: Выделить всё
npm installКод: Выделить всё
npm run watchAfter cleaning my project and then punctiliously following each and every step of the guide, I still get the same error.
Edit
The problem encountered was that I was using Symfony 7.0.1, while this method works for Symfony 6.
Источник: https://stackoverflow.com/questions/776 ... lus-bundle
Мобильная версия