Skip to content

Error Loading SVGs #88

Discussion options

You must be logged in to vote

This situation is expected. Dependances statistical analysis is only done on import statement,

If you need to use the require() (synchronous) form like in your example, the module must be provided at initialisation.
eg.

 const options = {
      moduleCache: {
        vue: Vue,
        mySvgImage: ...
      },
      ...

In your case, since your filename is an expression, the best solution is to use import() function :

import(`../assets/svg/${props.name}.svg`)
.then(svgData=> { svg.value = svgData })

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@leecbryant
Comment options

@FranckFreiburger
Comment options

@leecbryant
Comment options

@FranckFreiburger
Comment options

@leecbryant
Comment options

Answer selected by leecbryant
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