"__webpack_require__ is not defined" with atlassian-webresource-webpack-plugin

I’m trying to use the atlassian-webresource-webpack-plugin, but I am getting:

Uncaught ReferenceError: __webpack_require__ is not defined
    at batch.js?devtoolbar=true&gatekeeper-ui-v2=true&healthcheck-resources=true&highlightactions=true&hostenabled=true&locale=en-US&user-logged-in=true:24285:27

My JS file is:

alert("Hello world!");

And Atlassian’s webpack plugin transforms it into:

"undefined"!=typeof AJS&&(__webpack_require__.p=AJS.contextPath()+"/s/DEV_PSEUDO_HASH/_/download/resources/com.playsql.requirementyogi:assets-DEV_PSEUDO_HASH/"),alert("Hello world!");


If it helps, my webpack.config.js is this:

const path = require('path');
const WrmPlugin = require("atlassian-webresource-webpack-plugin");

const PLUGIN_KEY = "com.playsql.requirementyogi";
const FRONTEND_SRC_DIR = "./requirementyogi/src/main/front-end";
const OUTPUT_DIR = "./requirementyogi/target/classes";

module.exports = {
  entry: {
    'my-entry': './' + path.join(FRONTEND_SRC_DIR, 'my-first-file.js'),
  plugins: [
    new WrmPlugin({
      pluginKey: PLUGIN_KEY,
      contextMap: {
        // Those are the <context> tags that should be found in the atlassian-plugin.xml, so if you need
        // more contexts, search Confluence's source code for <context> tags.
        'my-feature': ['atl.general'],
      xmlDescriptors: path.resolve(OUTPUT_DIR, 'META-INF', 'plugin-descriptors', 'wr-defs.xml')
  output: {
    filename: 'bundled.[name].js',
    path: path.resolve(OUTPUT_DIR),

The solution came from @remie (maybe you want to get credits for this answer, Remie ;), copy it if you want):

I didn’t have the “runtime”, which can be included by adding the following config to module.exports:

  optimization: {
    runtimeChunk: 'single',
1 Like