Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support watching feature #42

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

guanghechen
Copy link

  • Pass additional filePath info into transform func
  • Add watchStart feature, trigger recopy when files changed

@codecov
Copy link

codecov bot commented Apr 27, 2020

Codecov Report

Merging #42 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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.

@DominicTobias-b1
Copy link

Any plans to merge this in @vladshcherbin ?

@guanghechen
Copy link
Author

guanghechen commented Oct 4, 2020

I think maybe you can use @guanghechen/rollup-plugin-copy as a temporary alternative.

@ViRuSTriNiTy
Copy link

@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?

@ViRuSTriNiTy
Copy link

ViRuSTriNiTy commented Aug 27, 2021

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.

@mindplay-dk
Copy link

Installed the fork and this works for me! Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants