Skip to content

Importing npm dependencies with Webpack and Shopify #29

Closed Answered by Accudio
UnleashedMySelf asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @UnleashedMySelf!

The problem you're asking isn't really related to Async Alpine as it just loads the files rather than handling anything like imports.

You're going to need to use Webpack in order to bundle imports from npm, so you can't just import the file directly using ax-load-src, you'll need to run it through Webpack first.

The easiest way of doing that is using AsyncAlpine.data and Webpacks dynamic import() which I think should work on Shopify still, without using asset_url.

Alternatively what I do on the Shopify sites I work on is to set up my bundler to process the component files separately from the main bundle and output them to the assets directory. This however would invol…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@UnleashedMySelf
Comment options

@UnleashedMySelf
Comment options

@Accudio
Comment options

@Accudio
Comment options

Answer selected by UnleashedMySelf
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants