sapphi-red / vite-plugin-static-copy

rollup-plugin-copy with dev server support.
MIT License
299 stars 32 forks source link

Unable to access assets from public dir #60

Closed markmckimbv closed 1 year ago

markmckimbv commented 1 year ago

Apologies if i've missed something obvious, but I'm having issues serving a JSON file from the public dir while running the dev server.

I understand that the files are not physically copied when running the dev server, but my assumption is that they are still accessible.

viteStaticCopy({
  targets: [
    {
      src: '../../libs/my-lib/translations/en-US/translations.json',
      dest: './'
    }
  ]
})

Trying to access the file (via browser) on: http://localhost:8080/translations.json and getting a 404.

I've tried multiple different values for dest including:

Nothing seems to work.

I can see that it is finding the file in question: [vite-plugin-static-copy] Collected 1 items.

Am I missing something? Thanks in advance!

markmckimbv commented 1 year ago

Nevermind - Mistake on my part. I had structured set to true which was preventing it from working as expected.

Got it working. Thanks anyway!