bradmartin / nativescript-gif

NativeScript plugin to use native gifs
Other
50 stars 18 forks source link

Local source not found #30

Closed seveneye closed 5 years ago

seveneye commented 5 years ago

Hi @bradmartin , I cant seem to make it to work with local gifs.

My gif is located in src/app/gifs, and i reference it using

Also tried, "~/gifs/icon.gif", but they never work. It always say there is no such file or directory

Any idea on this?

bradmartin commented 5 years ago

I'd guess your build doesn't have the files. Since this works, per demo here

Do a complete rebuild of your app, also test if adding an image (png or jpg) and using Image works to ensure you're files are being added to the built application.

seveneye commented 5 years ago

hi @bradmartin , im using angular not sure if its a webpack issue, but it seems that gif files are not bundled. I renamed the gif to png and it worked. Thanks for your response!

bradmartin commented 5 years ago

That seems like a webpack issue, where you don't have the file being included in the build. This has come up before on the NS slack community and that was the case. I don't have the answer anymore though, but somewhere you have to make sure webpack knows about the files.

Whip commented 3 years ago

Indeed webpack doesn't include gifs by default. To add that to webpack I added the line

{ from: { glob: '**/*.gif', dot: false } },

to config.plugins[CopyWebpackPlugin]. It looks like this now

new CopyWebpackPlugin([
      { from: { glob: 'assets/**', dot: false } },
      { from: { glob: 'fonts/**', dot: false } },
      { from: { glob: '**/*.jpg', dot: false } },
      { from: { glob: '**/*.png', dot: false } },
      { from: { glob: "**/*.gif", dot: false } },
], copyIgnore),