Closed getkey closed 5 years ago
I've been working on this in my spare time for a few days, updating the build process to use the same one as v5. I now have it at a point where imports and global namespaces work for both v4 and v5, with manual tests to prove it. I am taking this opportunity to fix some other oddities in the documentation process, so it'll be a little bit before I make a release (hopefully before or shortly after the official v5 release).
New release! v4.0.0 should fix all of this.
Thanks, great work! :smile:
In the ES export, I'm getting an error, because it tries to import ticker
wich is not exported by pixi v5. Looks like the ES export can't support both v5 and v4.
> yarn watch
yarn run v1.13.0
$ rollup -c --watch
NODE_ENV: undefined, watch: true
[!] Error: 'ticker' is not exported by node_modules/pixi.js/lib/pixi.es.js
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
node_modules/pixi-particles/lib/pixi-particles.es.js (8:55)
6: * http://www.opensource.org/licenses/mit-license
7: */
8: import { BLEND_MODES, Point, Texture, Sprite, VERSION, ticker as ticker$1, Ticker, Rectangle, Circle, settings } from 'pixi.js';
^
9:
10: /**
Error: 'ticker' is not exported by node_modules/pixi.js/lib/pixi.es.js
at error (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:3601:30)
at Module.error (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:14470:9)
at handleMissingExport (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:14397:21)
at Module.traceVariable (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:14739:17)
at ModuleScope.findVariable (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:13408:37)
at BlockScope.ChildScope.findVariable (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:4248:67)
at MemberExpression.bind (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:12369:47)
at AssignmentExpression.NodeBase.bind (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:10242:23)
at AssignmentExpression.bind (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:10998:31)
at ExpressionStatement.NodeBase.bind (/mnt/data/devel/xplozzle/node_modules/rollup/dist/rollup.js:10242:23)
1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Ugh, it would be fine, if rollup didn't transform my imports for the ES export. This requires some investigation.
4.0.1 is published and should fix this.
Thanks, it works! :tada:
The ES6 module build of Pixi v5 (I tried with the RC2) no longer exports the
PIXI
global variable (see https://github.com/pixijs/pixi.js/commit/14fa305ada60fc631cb4a07d78d8aae0d820c969).When using the ES6 module build of Pixi v5, pixi-particles throws
pixi-particles requires pixi.js to be loaded first
because it expects Pixi to be global.The obvious solution would be making Pixi a peer dependency, but then the browser build will break. I think the way to go about this it to make 2 builds:
import
s/require
s Pixi installed as a peer dependency. I would be in favor of an ES6 build because the"module"
field could be used in package.json, making it easy to import for ES6 users without breaking for other users that rely on the"main"
field.import ... from 'pixi.js'
into a reference to the globalPIXI
variable. I know this is possible with some bundlers but I have no experience with browserify.