sapphi-red / vite-plugin-static-copy

rollup-plugin-copy with dev server support.
MIT License
270 stars 29 forks source link

[suggestion] throws an error when it doesn't find the file/path #126

Open tassioFront opened 1 week ago

tassioFront commented 1 week ago

[suggestion] throws an error when it doesn't find the file

I have been using the vite-plugin-static-copy for a while and recently I needed to move the file path it copies. So, I changed the copied file from src/old-path to src/new-path, but I forgot to update the plugin configuration:

   viteStaticCopy({
      targets: [
        {
          src: './src/old-path.js', // I must update this line, but even without doing it the build keeps working.
          //...more config
        },
      ],
    }),

Unfortunately, it does not throw any error, so I noticed it fails after manual validations. Does make sense to throw an error when the plugin doesn't find the file?

sapphi-red commented 6 days ago

I think we can have a warning log in build.

tassioFront commented 6 days ago

To be honest, I think it should fail once the application won't work as expected, but a warning would help a lot. :raised_hands:

tassioFront commented 5 days ago

@sapphi-red, I was creating the PR when I saw this on my terminal: Screenshot from 2024-09-13 15-14-52

This validation is done here

Guess it proves the warning is not enough. :sweat_smile: Anyway, let me know if makes sense to open the PR with an error msg; or I can keep the warning, but change the message like:

'No file was found to copy on ${src} src.'

otherwise, we can close the issue.