NekR / offline-plugin

Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
MIT License
4.52k stars 295 forks source link

Allow to apply arbitrary plugins when compiling ServiceWorker script #358

Open akihikodaki opened 6 years ago

akihikodaki commented 6 years ago

I'd like to use this feature to embed some environment variables in my custom entry module with EnvironmentPlugin. I have optional CDN_HOST environment variable to determine an object storage in use. The entry module should have the variable, and be able to cache files served from the host.

There could be other use cases, considering the wide use of process.env.NODE_ENV. It is nice to have.

Question: I have not implemented a test case, but should I? Should I place it at tests/legacy or tests? (I'm not sure what legacy means.)

NekR commented 6 years ago

Question: I have not implemented a test case, but should I? Should I place it at tests/legacy or tests? (I'm not sure what legacy means.)

Yeah, please, write tests. legacy it's just name, there were supposed to be new tests, but they were never made. Of course, if all tests are in tests/legacy, then you should put yours there as well.

NekR commented 6 years ago

I'll be happy to merge this once everything is fixed.