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

Watch Mode #7

Closed
asfktz opened this issue Jul 4, 2017 · 7 comments
Closed

Watch Mode #7

asfktz opened this issue Jul 4, 2017 · 7 comments

Comments

@asfktz
Copy link
Owner

asfktz commented Jul 4, 2017

Currently, the conditions for cache invalidation are:

  1. npm install / npm remove
  2. The plugin's settings are different from the last build.

As discussed in facebook/create-react-app#2710
Adding a watch functionality might be useful.

For examples, if someone adds a 'console.log()' in one of the node_modules, it will trigger a new build.

@viankakrisna
Copy link
Contributor

viankakrisna commented Jul 4, 2017

For the watch option, I think it should be an array of resolved paths that we should watch.

{
  watch: [
     path.resolve('package.json'),
     path.resolve('package-lock.json'),
     path.resolve('yarn.lock'),
     path.resolve('node_modules')
     path.resolve('webpack.config.js')
  ]
}

And save hashes of those files and directory in the cache folder. So instead of just comparing JSON, isCacheValid will compare hashes of files, folder, and setting. This would affect the initial build time but will make overall validation more accurate in the next start.

Then, the compiler needs to run in watch mode if watch property is truthy in the setting. I haven't thought through the implementation of this phase, should the main compiler run if the DLL compiler finished compiling?

@viankakrisna
Copy link
Contributor

btw I've written a similar implementation of this plugin in this CRA PR. It would be nice if we can join the feature.

@asfktz
Copy link
Owner Author

asfktz commented Jul 5, 2017

Hi, @viankakrisna! good to see you here (:
I apologize for the late response, the real world got waaay too busy for me in the last few days.
Bad timing I guess 😅

Thanks for the PRs! I am eager to dive into it. That's my plan for tomorrow.

@viankakrisna
Copy link
Contributor

No problem! Just ping me if you need anything :)

@asfktz
Copy link
Owner Author

asfktz commented Jul 5, 2017

Oh and one more thing!

Please keep in mind that more than one instance of the plugin can be used.
Like in this case: #2 (comment)

@viankakrisna
Copy link
Contributor

that's making cleanup trickier, maybe we can set up a counter inside the constructor?

@viankakrisna
Copy link
Contributor

updated #13 with NODE_ENV and instance id

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

No branches or pull requests

2 participants