Bitbucket-client-side-extensions-template broken on PR overview page

Hi, For someone new trying out ahttps://bitbucket.org/atlassianlabs/bitbucket-client-side-extensions-template.git - none of the PR overview page extensions work.

Just loading http://localhost:7990/bitbucket/projects/PROJECT_1/repos/rep_1/pull-requests/1/overview shows this error in browser console.

extensions-pull-request-action-extension-js.js:10 Uncaught ReferenceError: module is not defined
    at 2784 (extensions-pull-request-action-extension-js.js:10:12)
    at o (bootstrap:19:32)
    at extensions-pull-request-action-extension-js.js:13:317
    at t (jsonp chunk loading:34:28)
    at nonce:1:26


which clicks to 
if (module.hot) ...

The default is already false ?

config/webpack.config.js
38:        hot: false,

Jira might be related/known. Any workarounds or suggestions to get around this ?

Hi **jijojv, **

Which bitbucket version you are using?

Are you trying the plugin as is or modifying the extension, I am trying to know if this is related to specific version or the extensions example repo.

It says that it can not even find module, I am guessing it is related to how you are setting up the plugin.

Is below example working for you, or it has same errors?

Hi,

I’m trying Bitbucket as is. And only PR extensions are broken as I can see the diff toolbar extension seen in Bitbucket

Hey

Thanks for reporting the issue.

Yup, I am able to replicate the same issue with Bitbucket 9.4 and the latest changes from CSE template.

I have raised https://jira.atlassian.com/browse/BSERV-20162 for the same

Looks like even if the hot is set to false in webpack config the ClientsideExtensionWebpackPlugin is generating code that still includes hot module replacement logic.

Easiest workaround will be to update plugins in webpack config

plugins: [
                ...plugins(!isProduction),
                clientsideExtensions,
                new webpack.DefinePlugin({
                    'module.hot': 'false',
                }),
            ],

I am looking into this and will update the template repo as well