rubenspgcavalcante/webpack-chrome-extension-reloader

Don't listen to port in production

Closed this issue · 0 comments

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: macOS 10.3
  • Version: 0.6.7

Going to open a PR:

  • yes
  • no

Description:

Currently, the plugin is still not easy to use without conditions in the Webpack configuration. In the readme it says:

Note: the plugin only works on development mode, so don't forget to set the NODE_ENV before run the command above

Here's the related code in the script:

if (process.env.NODE_ENV !== "production") {
compiler.plugin("compilation", comp =>
comp.plugin(
"after-optimize-chunk-assets",
chunks =>
(comp.assets = {
...comp.assets,
...this._injector(comp.assets, chunks)
})
)
);

Although, it doesn't try to reload the Chrome extension in production mode, it still connects to the port and so you need to still add conditionals in the webpack configuration file if you're using the same configuration across environments.