rollup-plugin-copy
rollup-plugin-copy copied to clipboard
Support watching feature
- Pass additional filePath info into transform func
- Add watchStart feature, trigger recopy when files changed
Codecov Report
Merging #42 into master will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #42 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 50 75 +25
Branches 17 21 +4
=========================================
+ Hits 50 75 +25
Impacted Files | Coverage Δ | |
---|---|---|
src/index.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1fa1c25...7c258e3. Read the comment docs.
Any plans to merge this in @vladshcherbin ?
I think maybe you can use @guanghechen/rollup-plugin-copy as a temporary alternative.
@guanghechen Thanks for adding watch mode support. I tried to use your fork to copy some files from the build output directory to another location but it results in an infinite loop of builds. Somehow your fork seems to update the files in the source location and then rollup restarts the build process or something.
My configuration looks like this:
copy({
targets: [
{ src: 'build/modules/brz-button', dest: 'app/BlazorWebComponents/wwwroot/js/web-components/brz' },
{ src: 'build/property-*.js*', dest: 'app/BlazorWebComponents/wwwroot/js/web-components' }
],
verbose: true,
copyOnce: true // <- thought this could fix the inifnite loop but to no avail
})
Do you have an idea what could cause this?
Ok, found it.
Your plugin calls addWatchFile to instruct rollup to watch for changes ... in the build output directory in my case 🤦♀️. Obviously this does not make sense as the fresh build output is then immendiately picked up as changed and another build step is triggered.
Fortunately rollup provides an option to exclude certain files from watch. I extended my configuration with
watch: {
exclude: 'build/**'
}
and now it works perfectly.
When I think about it now, it seems that I don't need the changes in your fork as I'm simply copying the build output file and these files don't need watching as the copy plugin would be triggered anyway when rollup initiates the build.
Installed the fork and this works for me! Thanks! 👍