# Compiling Javascript Storefront Plugins with theme:compile?

**URL:** <https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590>\
**Category:** Programmierung\
**Created:** [29. April 2020 um 13:54 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590 "2020-04-29T13:54:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![WernerBu](https://avatars.discourse-cdn.com/v4/letter/w/71c47a/32.png) [@WernerBu](https://forum.shopware.com/u/WernerBu)\
**Post date:** [29. April 2020 um 13:54 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/1 "2020-04-29T13:54:14Z")

</div>

Hi,

bin/console theme:compile doesn’t only compile the scss-File’s.

Is it possible to compile the Javascript-Plugin’s for the Storefront.

I’m using the production environment.

I know, that with the development envirornment i have to use `./psh.phar storefront:build`

Thanks and best regards,

Werner.

&nbsp;

---

<div class="post-metadata">

**Author:** ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)\
**Post date:** [29. April 2020 um 14:12 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/2 "2020-04-29T14:12:16Z")

</div>

I quote the documentation here:

> For CSS and Javascript things are a bit different. CSS and SCSS is handled by a PHP SASS compiler.
> 
> **JavaScript can’t be compiled by PHP** so [webpack](https://webpack.js.org/) is used for compilation. This also means that you have to **ship your plugin with the JavaScript already build**.

> **[Add Custom Assets | Shopware Documentation](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-assets.html)**
>
> Documentation for Shopware developers

&nbsp;

So no, that’s not possible, you have to precompile it with storefront:build

&nbsp;

Regards

---

<div class="post-metadata">

**Author:** ![WernerBu](https://avatars.discourse-cdn.com/v4/letter/w/71c47a/32.png) [@WernerBu](https://forum.shopware.com/u/WernerBu)\
**Post date:** [29. April 2020 um 14:25 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/3 "2020-04-29T14:25:17Z")

</div>

Hi,

okay, thank’s.

I know, that webpack is used for compilation.

I have asked the question poorly, sorry.  
Does Shopware intend to make this possible also in the production environment or will it never work

and I absolutely have to use the develop environment?

Thanks,

Werner.

---

<div class="post-metadata">

**Author:** ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)\
**Post date:** [29. April 2020 um 14:34 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/4 "2020-04-29T14:34:41Z")

</div>

Hi Werner,

there’s no javascript PHP compiler supporting modules.  
So no, you’ll have&nbsp;to use Webpack (development template) and it won’t change in the near future.

---

<div class="post-metadata">

**Author:** ![WernerBu](https://avatars.discourse-cdn.com/v4/letter/w/71c47a/32.png) [@WernerBu](https://forum.shopware.com/u/WernerBu)\
**Post date:** [29. April 2020 um 14:39 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/5 "2020-04-29T14:39:34Z")

</div>

Hi,

okay, thanks.

Best regards,

Werner.

---

<div class="post-metadata">

**Author:** ![WernerBu](https://avatars.discourse-cdn.com/v4/letter/w/71c47a/32.png) [@WernerBu](https://forum.shopware.com/u/WernerBu)\
**Post date:** [12. Mai 2020 um 12:42 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/6 "2020-05-12T12:42:09Z")

</div>

Hi,

well, I’m a little confused.  
Actually bin/build-storefront.sh does work to compile my Javascript-Plugin, but the question is whether it is a coincidence that this works in the production environment or should it also work from the shopware side. In other words, this will always work in the future?

Best regards,

Werner.

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [12. Mai 2020 um 13:50 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/7 "2020-05-12T13:50:44Z")

</div>

[https://github.com/shopware/production/blob/6.1/bin/build-storefront.sh](https://github.com/shopware/production/blob/6.1/bin/build-storefront.sh)

This script uses npm and nodejs - so if your production environment hast both installed, it will work. Normally you won’t finde nodejs or npm on production environments.

---

<div class="post-metadata">

**Author:** ![WernerBu](https://avatars.discourse-cdn.com/v4/letter/w/71c47a/32.png) [@WernerBu](https://forum.shopware.com/u/WernerBu)\
**Post date:** [12. Mai 2020 um 14:01 UTC](https://forum.shopware.com/t/compiling-javascript-storefront-plugins-with-theme-compile/66590/8 "2020-05-12T14:01:59Z")

</div>

Hi,

yes i know, but good to know it’s supposed to work.

Thanks and best regards,

Werner.
