Intermittent Parse Error on Plugin Rebuild

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?

1 Like

Might help if you shared the repo.

The repo is here:

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?

1 Like

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?

@team Is it always supposed to be assuming it’s es6?