pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
794 stars 125 forks source link

Issue with browserify - Missing modules #41

Closed marekventur closed 7 years ago

marekventur commented 7 years ago

Since 2.1.0 I'm getting

Cannot find module './ParticleUtils' from '/Users/marek/workspace/be-the-king/node_modules/pixi-particles/dist'
Cannot find module './Particle' from '/Users/marek/workspace/be-the-king/node_modules/pixi-particles/dist'

when trying to build a project with pixi-particles. I've looked through the changeset, but I couldn't find what has caused this problem. Any ideas?

themoonrat commented 7 years ago

Have you done an npm i since the last release? As it added a build step in

marekventur commented 7 years ago

@themoonrat: yes, that how I got the new version in the first place. Our jenkins does a fresh build every time and gets the same error.

themoonrat commented 7 years ago

ah ok. Haven't actually done a new build on 2.1.0 yet, but adding pixify for the build stage is what would have caused it

andrewstart commented 7 years ago

I redid my npm install, and didn't have a problem building or running the examples afterwards. Is the error you are getting during npm run build or when trying to use the library after building?

marekventur commented 7 years ago

npm install works without a problem, it's when we run browserify that an error gets thrown:

00:07:10.535 [14:34:10] Starting 'browserify'...
00:07:16.695 events.js:141
00:07:16.695       throw er; // Unhandled 'error' event
00:07:16.695       ^
00:07:16.695 
00:07:16.695 Error: Cannot find module './ParticleUtils' from '/var/lib/jenkins/jobs/game-master/workspace/node_modules/pixi-particles/dist'
00:07:16.695     at /var/lib/jenkins/jobs/game-master/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
00:07:16.695     at load (/var/lib/jenkins/jobs/game-master/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
00:07:16.695     at onex (/var/lib/jenkins/jobs/game-master/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
00:07:16.695     at /var/lib/jenkins/jobs/game-master/workspace/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
00:07:16.695     at FSReqWrap.oncomplete (fs.js:82:15)
marekventur commented 7 years ago

I can try to reduce it down to a minimal example, but I was hoping the problem would be obvious from the description :(

andrewstart commented 7 years ago

Ah, you are trying to browserify pixi-particles into your code? I haven't used browserify too much - are there any known problems with browserifying a browserified library?

marekventur commented 7 years ago

generally not, at least none I'm aware of.

andrewstart commented 7 years ago

It is indeed a known issue without an official solution: https://github.com/substack/node-browserify/pull/1151. http://stackoverflow.com/a/28176927 provides some workaround suggestions.

marekventur commented 7 years ago

I didn't expect that. Thanks for digging this out, I'll see what I can do. I guess this means I can close this issue?

andrewstart commented 7 years ago

Yep, although would like to know which workaround works best (for you).

marekventur commented 7 years ago

I'll keep you posted - although I doubt I'll have much time to poke it this week :(

hypercross commented 7 years ago

it's 2017, and seems like browserify would need a derequire pass to rename all require() calls in the bundle so that browserify skips module loading.

kribblo commented 6 years ago

derequire added in 2.1.7, see if that helps?