-
Notifications
You must be signed in to change notification settings - Fork 1
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
How to use with import in react? #5
Comments
Ominously, If you search Stackoverflow for I think the most probable reason is you are importing in ECMA script module syntax, but the module is written in CommonJS syntax. Node.js sometimes needs a bit of guidance to handle these mixed format situations. As a short term remedy, you could try to include https://www.npmjs.com/package/next-transpile-modules with your nextjs configuration. It transpiles all modules just the way the Babel configuration expects them. I'll look further into whether I can help from my side. |
2a3f251 adds a hint to package.json about the module format. Not sure that will help, but you can try to update to the 1.0.4 version. |
@ccprog thanks for your help, unfortunately it's still not working but I'm going to have a gander today and will update here when I've eventually figured it out :) |
hey @ccprog — I have found a very simple solution, I changed the rollup config to output 'umd' instead of 'cjs' or 'iife' and that output a file which I can import into react like how I wanted, I didn't want to fork just for this change but if you wanted to make that small update you know how :) |
Hey @ccprog — I'm trying to use this in a react project/nextjs but when I import and use
new Pathfit(...
it tells me that Pathfit isn't a constructor, I'm importing as so:after installing from npm, any ideas would be appreciated!
The text was updated successfully, but these errors were encountered: