bolt / redactor

📝 Bolt Extension to add the Redactor FieldType
MIT License
11 stars 11 forks source link

webpack-encore-bundle breaks redactor #30

Closed Alexandre-T closed 2 years ago

Alexandre-T commented 2 years ago

Hello and thank you for the bolt-cms and this redactor.

As soon as you install the webpack-encore-bundle, the redactor field is no more available because JQuery is no more available.

The javascript console ouputs: $ is undefined

Steps to reproduce:

composer create-project bolt/project myprojectname
cd myprojectname
symfony console doctrine:database:create
symfony console doctrine:schema:create
symfony console bolt:add-user --admin

To have a better look, you can init a new git repository and comment this line in .gitignore to check that assets directory isn't updated at all

#/public/assets/

Then install the package without running any scripts (to preserve the assets directory)

composer require symfony/webpack-encore-bundle --no-scripts
composer recipes:install symfony/webpack-encore-bundle --force -v

Then, whatever you follow or not instructions from the documentation, redactor won't work anymore as jQuery and its $ function are no more available.

I don't know if this issue is due to bolt/core implementation or bolt/redactor itself.

Alexandre-T commented 2 years ago

After some tests with redactor and article, it seems that it's a bug from the admin panel. There is no links with redactor. I close this issue and create another one in bolt/core.

michaelborn commented 2 years ago

The Symfony Encore docs cover this issue in depth, FYI.

https://symfony.com/doc/current/frontend/encore/legacy-applications.html#accessing-jquery-from-outside-of-webpack-javascript-files