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
getAssetPath not returning correct path #2269
Comments
I use "Copy" |
Can you expand on how you do that? Even when I use copy, the assets are not there in the npm module once it's built. I mean, they're there, but it appears that the path is incorrect in the code, because I don't have fonts or icons available in the component when I use it in a Gatsby site. |
|
Hi, Any Updates to this ? |
This is a major showstopper, unfortunately. |
I'm using stencilJs with integration with vue js in the mono-repo structure. you have to setAssetPath in your host app, see the link. I hope this explanation will help as well |
Stencil version:
I'm submitting a:
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
Using Local assets exactly as described in the documentation (https://stenciljs.com/docs/local-assets) is not working when including a Stencil Component in an external application.
The
assets
dir ends up in the directorydist/<component-name>/assets
. But when usinggetAssetPath
, it will return the directorydist/assets/
which will make loading of the resources in theassets
directory fail.Either the assets are not copied to the correct destination or
getAssetPath
is not returning the correct directory.Expected behavior:
getAssetPath
should return the path to the asset directory.Steps to reproduce:
I've created a simple test project to illustrate the problem:
https://github.com/bjolletz/stencil-getassetpath-test
It is generated from
npm init stencil
and then I've added astencil-asset
component, exactly as it is documented here: https://stenciljs.com/docs/local-assetsTo reproduce the problem:
If you check the Network tab in the developer tools in your browser, you will see that the resource (sunset.jpg) can not be loaded because of an invalid URL.
Related code:
Here's the
stencil-asset
component I copied from the documentation.Other information:
The text was updated successfully, but these errors were encountered: