drawcall / Proton

Javascript particle animation library
https://drawcall.github.io/Proton/
MIT License
2.42k stars 275 forks source link

Cannot Add Renderer: Proton is not defined #52

Closed OClement closed 6 years ago

OClement commented 6 years ago

Hi,

Have been trying to figure out what's the issue for a while but am stuck; I'm trying to setup a real quick/simple PoC with Angular on Stackblitz

I'm basically reusing the QuickStart code from Proton's Readme.md wrapped in a component. Everything looks fine, except when the code reaches this.proton.addRenderer(renderer); where it fails with a Proton is not defined error

Thinking it could be related to a Stackblitz issue (seeing how it complains about not being able to find the module, although it is clearly false), I created a brand new Angular-Cli project locally, and am having a different error: _1.default is not a constructor.

I tried import Proton from 'proton-js' as well as import {default as Proton} from 'proton-js' and import * as Proton from 'proton-js'; All three cases fails

TLDR:

There seem to be a problem with how the ProtonJs DEFAULT export is causing issues with (I guess) Webpack and how it handles default export (admittedly it may be Webpack/Angular-Cli issue but seeing as both uses tons of libraries likely to also export default modules, and how Proton seems to have had a related change recently...)

drawcall commented 6 years ago

Thank you for your feedback, you can download the latest v3.1.2 version.