Skip to content

Conversation

@HyperBrain
Copy link
Member

@HyperBrain HyperBrain commented Nov 16, 2017

What did you implement:

Closes #279

How did you implement it:

webpack.compiler.watch() automatically triggers a compile. This led to a double compile (with the second one being uncontrolled and asynchronous) on startup of the plugin together with serverless offline. The second unwanted compile was running in parallel with the serverless-offline start.

Now, for watch mode, the inital compile is skipped as the watch will do it anyway. For non-watch mode the regular webpack:compile lifecycle is triggered.

Additionally a new switch --webpack-no-watch has been added to turn off the default watch mode with serverless-offline. This is needed, if you use serverless-offline in an automated build that does integration tests (and changes the source tree) with an external script given to offline. There you only want to build once and test the output with serverless offline --exec automatically. As soon as the given script changes the source tree, it leads to a recompile which breaks the script.

How can we verify it:

Use serverless offline or serverless offline start and check that there is only one compile in the beginning (and not two) and that the plugin waits for its completion. Only then the offline plugin should start its work (watch mode enabled as before).

Use serverless offline --webpack-no-watch to start with watch mode disabled. Changes in the sources should not trigger a rebuild now.

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@sime
Copy link

sime commented Nov 16, 2017

This branch has solved #279, both locally and on travis.

Frank Schmid added 2 commits November 16, 2017 13:17
Added --webpack-no-watch switch for offline

Added wpwatch unit tests

Updated README
@HyperBrain HyperBrain merged commit 735a66f into master Nov 16, 2017
@HyperBrain HyperBrain deleted the webpack-no-watch branch November 16, 2017 12:35
jamesmbourne pushed a commit to jamesmbourne/serverless-webpack that referenced this pull request Oct 15, 2019
…ck-no-watch

Fixed uncontrolled second compile when entering watch mode for offline.
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

Successfully merging this pull request may close these issues.

Start offline after webpack is compiled

3 participants