Elkfox / Ajaxinate

🎡 Ajax pagination plugin for Shopify themes

Home Page:https://ajaxinate.elkfox.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package not loadable as module

isabelle-tommyjohn opened this issue · comments

commented

I'm using Slate and trying to load Ajaxinate as a module so that I can access it from my compiled JS files. I've added Ajaxinate as an alias in my slate.config.js file using require.resolve('./node_modules/ajaxinate'). However, this fails because Ajaxinate's package.json file contains "ajaxinate.js" as the value for its "main" attribute, which points to a file that doesn't exist. Presumately the value was meant to be "src/ajaxinate.js".

With that change, package loading works, but the module doesn't export the Ajaxinate constructor, so importing the package imports an empty object; fixing this would require an export statement before the constructor declaration.

If these changes would have no adverse impact, I believe they would help out those are want to use Ajaxinate with Slate and prefer to keep markup and behavior separated. I'd be more than happy to put together a pull request for this if desired.

@isabelle-tommyjohn Are you still keen to help with this? It sucks I didn't see this issue earlier. Quite a few people have been having the same issue.

I'm working on repackaging the whole thing with a focus on using it in Slate (and other dynamically compiled projects). But if you have a fix for the current version, that would be very very appreciated!

commented

@Cam I opened the above PR from the changes I made in my fork. I'd be more than happy to help out further in any way I can. Thanks!

@isabelle-tommyjohn great stuff, thanks. I'll merge this in ASAP and add the improvements I've been working on and bump this up to a new version.

Thanks!!