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

Watching "static" HTML/PHP files with Webpack #150

Open
1 of 3 tasks
stephan-v opened this issue Apr 29, 2018 · 2 comments
Open
1 of 3 tasks

Watching "static" HTML/PHP files with Webpack #150

stephan-v opened this issue Apr 29, 2018 · 2 comments

Comments

@stephan-v
Copy link

BEFORE YOU SUBMIT please read the following:

  • I'm submitting a bug report
  • I'm submitting a feature request
  • I'm submitting a support request

webpack version:
3.11.0

sw-precache-webpack-plugin version:
0.11.5

Please tell us about your environment:
Linux - Ubuntu 16.04

Browser: [Phantom XX | Chrome XX | Firefox XX | IE XX | Safari XX | Other XX]

Chrome 65

Current behavior:

I am wondering how to properly deal with this. Currently I am caching some Laravel PHP files like so:

dynamicUrlToDependencies: {
    '/': ['resources/views/home.blade.php']
}

This work but because the files are not part of the Webpack pipeline files like these are not being watched and a new service-worker.js file is never being generated once I edit files like home.blade.php.

It generates a hash without any problem but once I change this file I need to re-run my entire Webpack process to generate a new service-worker.js file which contains an updated hash.

I am not sure how a new service-worker.js file is currently being generated when Webpack notices a change in css or js file but the same would need to happen when html files like these have changed. Even if I could get Webpack to notice changes in these files I am unsure how to even call the plugin to re-generated the file.

Is there a good way to deal with this? Hopefully I have my question clear, otherwise ask me anything.

@stephan-v
Copy link
Author

After review how to create a Webpack plugin I see this plugin uses the hook:

compiler.plugin('after-emit', afterEmit);

The Webpack documentation states this runs:

After emitting assets to output dir

So I guess it will be pretty difficult to watch changes in static files with the way this plugin is currently set up?

@ctf0
Copy link

ctf0 commented Jun 3, 2018

the plugin is made more toward production, so watching files during dev is out of the scope.

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

No branches or pull requests

2 participants