ShukantPal / pixi-essentials

The best goodies for performant, enterprise-level applications built on PixiJS
https://api.pixijs.io
MIT License
285 stars 37 forks source link

Transformer and pixi7 doesn't work if bundled with webpack #85

Closed rougsig closed 1 year ago

rougsig commented 1 year ago

Transformer imports @pixi/interaction, but it was deprecated (as i understand) for pixi 7. At least i cant find version for pixi 7. That line broke all mouse behaviour. Looks like interactive = false, but it's not true.

I did monkey-patch for 3.0.1, just remove require('@pixi/interaction') from assembled js file. And all will works fine.

codepen works well on 3.0.1 and 7.2.4 pixi, because that code (header from transformer.js) in reality doesn't do require('@pixi/interaction') in browser.

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pixi/interaction'), require('@pixi/display'), require('@pixi/math'), require('@pixi-essentials/bounds'), require('@pixi-essentials/object-pool'), require('@pixi/graphics')) :
      typeof define === 'function' && define.amd ? define(['exports', '@pixi/interaction', '@pixi/display', '@pixi/math', '@pixi-essentials/bounds', '@pixi-essentials/object-pool', '@pixi/graphics'], factory) :
        (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global._pixi_essentials_transformer = {}, null, global.PIXI, global.PIXI, global.PIXI, global.PIXI, global.PIXI));
  }(this, (function (exports, interaction, display, math, bounds, objectPool, graphics) { 'use strict'; })));

As fix: Is it okay to just drop @pixi/interaction import?

cc https://github.com/ShukantPal/pixi-essentials/issues/84

rougsig commented 1 year ago

cc https://github.com/ShukantPal/pixi-essentials/pull/86

ShukantPal commented 1 year ago

This should be fixed in @pixi-essentials/transformer@3.0.2