Code Monkey home page Code Monkey logo

Comments (13)

liamdebeasi avatar liamdebeasi commented on May 27, 2024 1

There's likely an issue with the asset path either not being defined or being defined incorrectly when loading the Ionicon. I'm going to move this over to the Ionicons repo so we can take a closer look.

from ionicons.

sagarkm avatar sagarkm commented on May 27, 2024 1

I am facing the same issue in my project:
// Works when project runs and vitest passes as well
// Works when project runs, but fails in vitest : TypeError: Invalid URL

Important Update:
When running the vitest in Node 16.60.0 there seems to be no issue - test runs succesfully.
But when the same vitest is run in Node 18.18.0 the test fails with above issue.

from ionicons.

ionitron-bot avatar ionitron-bot commented on May 27, 2024

Thanks for the issue! This issue has been labeled as holiday triage. With the winter holidays quickly approaching, much of the Ionic Team will soon be taking time off. During this time, issue triaging and PR review will be delayed until the team begins to return. After this period, we will work to ensure that all new issues are properly triaged and that new PRs are reviewed. In the meantime, please read our Winter Holiday Triage Guide for information on how to ensure that your issue is triaged correctly. Thank you!

from ionicons.

rdlabo avatar rdlabo commented on May 27, 2024

@asifrahman112 Is the path /image.svg correct?
Angular copies everything under assets into the build file, so in most cases it should be /assets/image.svg or /assets/**/image.svg.

from ionicons.

asifrahman112 avatar asifrahman112 commented on May 27, 2024

@asifrahman112 Is the path /image.svg correct? Angular copies everything under assets into the build file, so in most cases it should be /assets/image.svg or /assets/**/image.svg.

@rdlabo yes the path is correct...since its loading correctly in my project and I can access the image on that path. But the test fails with inavlid url message

from ionicons.

rdlabo avatar rdlabo commented on May 27, 2024

@asifrahman112 Thanks reply. Now, try moving your SVG files under /assets. The error text in the image says it is looking in /assets.

Failed to parse URL from /assets/nozzle.svg

from ionicons.

asifrahman112 avatar asifrahman112 commented on May 27, 2024

@rdlabo The image is already placed in assets folder in the root public directory

from ionicons.

rdlabo avatar rdlabo commented on May 27, 2024

rdlabo/ionic-react-vite-src-icon@2d48a70

@asifrahman112 I had mistakenly commented on some of the configurations. Please check the project that we have made which is displayed correctly. This project is based https://github.com/ionic-team/starters/tree/main/react-vite

from ionicons.

liamdebeasi avatar liamdebeasi commented on May 27, 2024

@asifrahman112 Can you provide a GitHub repo with a minimal reproduction?

from ionicons.

ionitron-bot avatar ionitron-bot commented on May 27, 2024

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

from ionicons.

asifrahman112 avatar asifrahman112 commented on May 27, 2024

@rdlabo The image displays correctly in my project. Only the unit test fails on vitest with the error I have mentioned above

from ionicons.

asifrahman112 avatar asifrahman112 commented on May 27, 2024

@liamdebeasi I have added the stackblitz url for the issue reproduction
https://stackblitz.com/edit/ionic-react-vitest-example-qfvsxq?file=src%2Fcomponents%2FHeader.tsx

@liamdebeasi If you do npm run dev it works correctly, and the image is displayed properly but if you do npm run test it gives error

from ionicons.

sofi-algoritcom avatar sofi-algoritcom commented on May 27, 2024

I have the same problem. As @sagarkm mentioned above, the issue disappears when running the tests with node 16, it seems to be a problem with node 18. Any solution found to this? 🙏

from ionicons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.