# Intermittent Parse Error on Plugin Rebuild

**URL:** <https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727>\
**Category:** Development\
**Created:** [May 17, 2020, 1:25am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727 "2020-05-17T01:25:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)\
**Post date:** [May 17, 2020, 1:25am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727/1 "2020-05-17T01:25:44Z")

</div>

In working on a bbcode plugin, we’re seeing an error appear related to one of the JS files we’ve added. This error only appears when updating the plugin or rebuilding the container, but does not occur every time. If I update the plugin via the admin UI and it fails, re-running the same upgrade again without making any changes will then succeed.

Any ideas what is going on here?

 ![WindowsTerminal_ija22ioP8D](https://global.discourse-cdn.com/meta/original/3X/7/7/77a4f508475ce8d3864cd40cb510017ca3db8278.png)

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [May 17, 2020, 5:28am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727/2 "2020-05-17T05:28:07Z")

</div>

Might help if you shared the repo.

---

<div class="post-metadata">

**Author:** ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)\
**Post date:** [May 17, 2020, 5:37am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727/3 "2020-05-17T05:37:12Z")

</div>

The repo is here:  
[https://github.com/Ghan04/discourse-rpn-bbcode](https://github.com/Ghan04/discourse-rpn-bbcode)

We’ve removed the default assignment in the function definition and it seems to behave better, but that shouldn’t be necessary as far as I can tell. Why would that break the parser?

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [May 17, 2020, 5:42am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727/4 "2020-05-17T05:42:19Z")

</div>

Just a guess: is it not interpreting the file as es6 because the file extension is .js? If you change the suffix, does it make a difference? (You’d need to replace a default parameter to test this obviously.)

If that’s the case then there’s an issue with core? It should always be assuming it’s es6?

---

<div class="post-metadata">

**Author:** ![TheDarkWizard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thedarkwizard/32/177913_2.png) [@TheDarkWizard](https://meta.discourse.org/u/TheDarkWizard)\
**Post date:** [May 17, 2020, 6:09am UTC](https://meta.discourse.org/t/intermittent-parse-error-on-plugin-rebuild/151727/5 "2020-05-17T06:09:33Z")

</div>

> [@merefield](#):
>
> It should always be assuming it’s es6?

[@team](https://meta.discourse.org/groups/team) Is it always supposed to be assuming it’s es6?
