Problem with the hot-reload in Atlassian WRM webpack plugin (for Data Center)

Hi,

Has anyone succeeded to run https://bitbucket.org/serverecosystem/wrm-webpack-example and get the hot reload working in 2022?

I did! It’s awesome, I modify JS files and, if webpack-watch is running in the background, Confluence reloads the module without refreshing the page! It’s stunning!

But I don’t succeed to upgrade it to the most recent version of Atlassian WRM webpack plugin, and to Webpack 5. Can anyone help? In exchange, I’ve successfully upgraded it to a recent version of AMPS and Confluence, and I’ve made it into a nice PR to compare before the upgrade/after the upgrade:

https://bitbucket.org/requirementyogi/wrm-webpack-example/pull-requests/1/upgrading-to-webpack-5-and-atlassian-wrm

In particular, I wonder whether I have configured the dev-server properly, and if the chunkIds: "named" parameters have the correct effect:


    devServer: {
        host: hostname,
        port: devServerPort,
        client: {
            overlay: true,
            progress: true
        },
        hot: true,
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Headers': 'x-atlassian-mau-ignore'
        },
        allowedHosts: [
            '.local' // (for upgrade to Webpack 5)
        ]
    },

It’s all in the PR, if you can help me. Thank you heaps, and I’ll put the results back here, probably (hopefully with a demo project, so everyone will be able to use webpack’s hot reload on Jira DC). https://bitbucket.org/requirementyogi/wrm-webpack-example/pull-requests/1/upgrading-to-webpack-5-and-atlassian-wrm

Alternatively, please give me your webpack.config.js if you support the hot-reload in your Confluence/Jira pages, and the associated package.json. But I suppose those are hard-earned fruits of each one’s labour…

1 Like

Hi @aragot, I’m not sure what issue or error you have currently, but you might want to check those configs to find some inspiration about hot-reload:

Thanks,
Maciej

Hi Maciej,

Thank you very much for answering;

Nowadays we’re using Webpack 5 / WRM 5.2.9, and those examples are still using Webpack 4.41.5 (and associated libraries) and atlassian-webresource-webpack-plugin 5.0.1, and I think it’s the upgrade that breaks something. Perhaps an option is required.

Would you have an example with Webpack 5?

Thank you very much for sharing the files in any case - very helpful.

Best regards,
Adrien Ragot