serverless-webpack icon indicating copy to clipboard operation
serverless-webpack copied to clipboard

Enhance plugin for "serverless deploy --package" use case

Open kushanson opened this issue 5 years ago • 2 comments

This is a Feature Proposal

Description

Enhance serverless-webpack such that it does not execute any webpack tasks during "serverless deploy" when the "--package" option is present.

For bug reports:

  • What went wrong?
  • What did you expect should have happened?
  • What was the config you used?
  • What stacktrace or error message from your provider did you see?

For feature proposals:

  • What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us. Use Case: serverless supports "--package" option for the "serverless deploy" command. "--package" option is used to point to an already bundled ".serverless" folder. In this case, the webpack bundling would have occurred during "serverless package" phase to generate the ".serverless" folder. Webpack bundling does not need to occur again when using "--package" option with "serverless deploy" command. It would be ideal to not have any dependency on webpack when using "--package" option since all bundling has already occurred.

  • If there is additional config how would it look no additional config

Similar or dependent issue(s):

  • #398

Additional Data

  • Serverless-Webpack Version you're using: 5.3.1
  • Webpack version you're using: 4.41.2
  • Serverless Framework Version you're using: 1.57.0
  • Operating System: Windows 10
  • Stack Trace (if available): N/A

kushanson avatar Dec 17 '19 17:12 kushanson

@kushanson this sounds like a logical extension of the --no-build functionality I am working on in #504. If I understand correctly, you are suggesting:

  • deploy --no-build will not re-run any Webpack tasks, but will still generate CloudFormation etc. (at least when using the AWS provider) in the .serverless directory.
  • deploy --package will instruct serverless-webpack not to run any Webpack tasks, and Serverless will use existing output in .serverless.

This sounds like #504 is merged this should be fairly simple to implement by extending the plugin to not re-run Webpack tasks if the --package flag is present.

I think it is worth keeping the --no-build flag as an option as this serves a separate use case.

jamesmbourne avatar Dec 23 '19 14:12 jamesmbourne

@jamesmbourne you understand correctly. What you commented sounds good to me.

kushanson avatar Dec 23 '19 16:12 kushanson

@jamesmbourne any update on this?

trent-dailey avatar Dec 15 '22 22:12 trent-dailey

AFAIK --no-build is no longer supported, its feature is covered by --skip-build and --package.

Tested with the typescript example, webpack compile is not running when --package option is set.

@trent-dailey @jamesmbourne Feel free to reopen this if the problem still persist.

vicary avatar Dec 16 '22 03:12 vicary