A project I’m working needs a third party javascript snippet which has a dependency on the ‘full’ jQuery framework. Shopware (/bootstrap 4) currently ships with jQuery out of the box, but is using the Slim (and not full) version of it.
Is there a way to upgrade/change the used jQuery version?
4
Answers
In your plugin create a
webpack.config.js
the directory structure should look something like this:The content of
webpack.config.js
:Then within the
storefront
directory install the latest version of jquery or whatever specific version you need:In your
main.js
you can then import the newer jquery package from the resolved alias and set it globally:jQuery will be removed with the next major. It’s not future-proof to still use it. You should look for alternatives, it’s not so complicated with default javascript
It is possible to actually replace the slim jQuery with the full version.
In
MyPlugin/src/Resources/app/storefront/build/webpack.config.js
put the following:Small additional information:
If you change the webpack.config.js in ypour plugin make sure to build the frontend afterwards:
bin/build-storefront.sh