vladshcherbin/rollup-plugin-copy

Update Instructions: Run 'copy' after bundle created

dadiborn opened this issue · 2 comments

Thank you for plugin that only made my simple task 'Copy After Bundle was created' working.
Please add into documentation where you talking about default hook information that hooks should be taken from https://rollupjs.org/guide/en/#plugin-development and if we need to run 'copy' after bundle was made and written to drive, we need to use writeBundle hook like so copy({hook:'writeBundle',[..]})

And better to start your description that by default plugin runs before bundle was written to disk due default hook named 'buildStart'

To get into that point i spend a lot of time and was almost ready to write my own plugin because after one hour of digging into api i understand how it works now lol - it is good for me but thats the purpose of work you have done >> to just plug it in without any googling

@dadiborn hey, I've updated hooks option description with your suggestions.

By default, buildEnd hook is used because there are some things to know when using other hooks, for example if you have multiple chunks - writeBundle hook will be executed multiple times and the plugin will also copy files multiple times. This is why hook option is like an advanced one, for users who have some kind of rollup hooks knowledge :)

Thanks for using this plugin, readme clarification suggestion and sorry for the inconvenience. ❤️

Hello @dadiborn and @vladshcherbin I tried the plugin and work nice.
Got some headache to figure out all the hooks available on rollup.js (pretty much on the building order, cause I knew my file is generated but I didn't know on which stage) and which one will catch my situation.

using default hook:
image

using hook 'onwrite':
image

For some reason my file is generated "see blue strings" but is not copied together.
So For debug reasons try:

verbose: true,
hook: 'onwrite'

Hope my comment help someone on the future 💃