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

Respect the webpack config watch: false #1131

Open
matthew-gladman-oua opened this issue Apr 13, 2022 · 0 comments
Open

Respect the webpack config watch: false #1131

matthew-gladman-oua opened this issue Apr 13, 2022 · 0 comments

Comments

@matthew-gladman-oua
Copy link

matthew-gladman-oua commented Apr 13, 2022

This is a Feature Proposal

Description

It would be very effective if serverless-webpack respected the Webpack configuration for watch, this would make it not only consistent but easy to disable watch dynamically on a large number of serverless packages. Alternatively being able to disable watch via an env variable would also be pretty good.

Example implementations:

// wpwatch.js
if (this.webpackConfig.watch === false) {
   // If we do not watch we will just run an ordinary compile
   if (!this.log) {
     this.serverless.cli.log('Watch disabled by Webpack.');
   }
   return this.serverless.pluginManager.spawn('webpack:compile');
}

and / or

// wpwatch.js
if (process.env.CI) {
   // If we do not watch we will just run an ordinary compile
   if (!this.log) {
     this.serverless.cli.log('Watch disabled by detecting CI environment.');
   }
   return this.serverless.pluginManager.spawn('webpack:compile');
}

This would be useful for us, and potentially others that are also running many serverless offlines in a CI environment for integration tests, but adding in the --webpack-no-watch to serverless offline adds a lot of extra npm scripts for just the CI environment, this lets devs disable it globally without touching the npm scripts.

It also makes it less confusing on why watching isn't properly being disabled.

Similar or dependent issue(s):

  • N/A

Additional Data

  • Serverless-Webpack Version you're using: 5.6.1
  • Webpack version you're using: 4
  • Serverless Framework Version you're using: v2
  • Operating System: Linux
  • Stack Trace (if available): N/A
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

1 participant