-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't access init function using browserify #217
Comments
This is also happening to me. Maybe it has to do with the way rollup bundles the code? Perhaps rollup should generate multiple bundles in order to avoid this issue. I'm using https://www.npmjs.com/package/patch-package in the meantime as a workaround by adding the module.exports manually. |
I'm running into the same issue, except using Vite instead of Browserify. I'm not sure if the code as written would work in any bundler? |
@najajan-de @cesalberca @ianstormtaylor Hi, this bug should be fixed in v1.3.3. I added cjs output in rollup.config.js. BTW examples for Webpack and vite were also added: |
@zenozeng thank you, that worked on the first try! You are amazing! |
I'm using
import p5Svg from 'p5.js-svg';
andp5Svg(p5);
in my project.After packing with browserify, I'm getting this in the browser console:
Uncaught TypeError: (0 , p5_js_svg_1.default) is not a function
I figured out, that theres no module.export in p5.svg.js, so I added it on the begin of the file. With
it works just fine, so maybe you could consider to add this.
I don't know if there's another way to access the function outside module.exports
The text was updated successfully, but these errors were encountered: