Skip to content

Phaser 2 Webpack build error #72

@dougSmall31

Description

@dougSmall31

Hello,

I'm getting this error only on the production build, when I'm running on my local dev environment everything works fine.

Uncaught TypeError: Cannot set property 'game' of undefined
    at n.PluginManager.add (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at n.GameObjectFactory.plugin (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at e.value (bundle.js?b6ee61c795d18e338b66:1)
    at n.StateManager.preUpdate (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at e.updateLogic (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at e.update (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at n.RequestAnimationFrame.updateRAF (vendor.bundle.js?b6ee61c795d18e338b66:1)
    at window.requestAnimationFrame.forceSetTimeOut._onLoop (vendor.bundle.js?b6ee61c795d18e338b66:1)

When I completely remove the phaser-input field from that state the game runs fine in the production build. That leads me to believe it's an issue with phaser-input and webpack. I followed the instructions on issue #7 but am still having issues.

module: {
    rules: [
      {
        test: /\.js$/,
        use: ["babel-loader"],
        include: path.join(__dirname, "src")
      },
      { test: /pixi\.js/, use: ["expose-loader?PIXI"] },
      { test: /phaser-split\.js$/, use: ["expose-loader?Phaser"] },
      { test: /p2\.js/, use: ["expose-loader?p2"] },
      //added for phaser-input
      {
        test: /phaser\-input\.js$/,
        use: "exports-loader?PhaserInput=PhaserInput"
      },
      { test: /\.ts$/, enforce: "pre", loader: "tslint-loader" },
      { test: /\.ts$/, loader: "ts-loader" }
    ]
  },
  node: {
    fs: "empty",
    net: "empty",
    tls: "empty"
  },
  resolve: {
    extensions: [".ts", ".js"],
    alias: {
      phaser: phaser,
      pixi: pixi,
      p2: p2,
      "phaser-input": path.join(
        __dirname,
        "/node_modules/@orange-games/phaser-input/build/phaser-input.js"
      )
    }
  }

Any help is much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy