Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Unable to include assets from external app v1.x #501

Closed
et1421 opened this issue Apr 18, 2018 · 6 comments
Closed

Unable to include assets from external app v1.x #501

et1421 opened this issue Apr 18, 2018 · 6 comments

Comments

@et1421
Copy link

et1421 commented Apr 18, 2018

Possibly related: #409 #410

Problem

One app installed in my store (Multi Currency) needs to import some assets inside its snippets files.

But the dist folder seems to be deleted at the moment of compilation. Therefore, the liquid compilation crashes because the asset is inexistant.

The only way to deploy is to put the local link on build (http://localhost:8080/bold-currency-bootstrap.js), and then to go and change the URLs inside Shopify admin.

Replication steps

For example :
<script src="{{ 'bold-currency-bootstrap.js' | asset_url }}" defer></script>
ound bold-currency-converter.liquid snippet crashes the build process.

@t-kelly
Copy link
Contributor

t-kelly commented Apr 20, 2018

Hey @et1421! Could you try throwing whatever asset you need into the src/assets/vendors folder? We're currently copying any contents of that folder directly into the dist/assets. Does that work?

@et1421
Copy link
Author

et1421 commented Apr 23, 2018

The assets are in the src/assets/vendors folder and are copied inside the dist/assets, this part is working for the watch task, but on compilation an error is thrown (same problem as #408 )

Failed to compile.

undefined
Error in ./snippets/bold-currency-converter.liquid
Module not found: Can't resolve './bold-currency-bootstrap.js' in '/Applications/MAMP/htdocs//src/snippets'

@ multi ../node_modules/@shopify/slate-tools/tools/webpack/hot-client.js ../node_modules/@shopify/slate-tools/tools/webpack/static-files-glob.js

Compiled with warnings.

Warning in ./snippets/bold-currency-converter.liquid
Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve './bold-currency-bootstrap.js' in '/Applications/MAMP/htdocs//src/snippets'
@ . sync ^./snippets.*.liquid$
@ ../node_modules/@shopify/slate-tools/tools/webpack/static-files-glob.js
@ multi ../node_modules/@shopify/slate-tools/tools/webpack/hot-client.js ../node_modules/@shopify/slate-tools/tools/webpack/static-files-glob.js

but with the deploy task, a different problem occurs. I have about the same error (Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve './bold-currency-bootstrap.js' in '/Applications/MAMP/htdocs/<project-name>/src/snippets'), except at the moment the build crashes, there is no dist folder in the projet, because it has been deleted by the build process.

@pfcodes
Copy link

pfcodes commented Apr 28, 2018

Any update on this?

@numediaweb
Copy link

I think if you want to reference static files you shoud use:
""
instead of
''
see: #407 (comment)

@t-kelly
Copy link
Contributor

t-kelly commented Oct 25, 2018

@t-kelly t-kelly closed this as completed Oct 25, 2018
@lock
Copy link

lock bot commented Nov 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants