# Overriding plugin javascript in a theme component

**URL:** <https://meta.discourse.org/t/overriding-plugin-javascript-in-a-theme-component/213748>\
**Category:** Development\
**Created:** [January 3, 2022, 8:42pm UTC](https://meta.discourse.org/t/overriding-plugin-javascript-in-a-theme-component/213748 "2022-01-03T20:42:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [January 4, 2022, 10:55am UTC](https://meta.discourse.org/t/overriding-plugin-javascript-in-a-theme-component/213748/2 "2022-01-04T10:55:23Z")

</div>

Having the same code in both the theme component and the plugin seems a little weird to me - IMO it would be better to decide between theme-component/plugin, and then go all-in. Overriding entire files isn’t something we do ourselves, and it’s not something we recommend. To override core/plugin behaviour, your theme component should use methods like `api.modifyClass`.

I suspect the root cause here is that plugin ES6 modules are prefixed differently from core/theme modules. Running this on your site, I see the modules are prefixed with `plugin`. I suspect if you enabled the theme component, we’d see another entry, but with a different prefix.

![Screenshot 2022-01-04 at 10.53.36](https://global.discourse-cdn.com/meta/optimized/3X/e/1/e1bf4a95fda189812f483b0a64966d056eada12f_2_690x32.png)

---

_[View the full topic](https://meta.discourse.org/t/overriding-plugin-javascript-in-a-theme-component/213748)._
