You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not possible to set custom option values for the plugin with Serverless Variables. For example, we are trying to disable minification of code at local stage deployment.
The reason seems to be because the /** Set custom options */ logic is run before any Serverless hooks. This means that the variables have not been interpolated.
this.custom.optimize.minify literally has the value specified in serverless.yml, for example
this.custom.optimize.minify value is ${self:custom.enable_minify.${self:provider.stage}, 'true'}
I've fixed this by moving the custom options code in to the beforeCreateDeploymentArtifacts method, so that the options are set following the before:package:createDeploymentArtifacts hook. I'm not 100% confident that is a totally safe solution but it does the job.
It's not possible to set custom option values for the plugin with Serverless Variables. For example, we are trying to disable minification of code at local stage deployment.
The reason seems to be because the
/** Set custom options */
logic is run before any Serverless hooks. This means that the variables have not been interpolated.this.custom.optimize.minify
literally has the value specified in serverless.yml, for examplethis.custom.optimize.minify value is ${self:custom.enable_minify.${self:provider.stage}, 'true'}
I've fixed this by moving the custom options code in to the
beforeCreateDeploymentArtifacts
method, so that the options are set following thebefore:package:createDeploymentArtifacts
hook. I'm not 100% confident that is a totally safe solution but it does the job.Steps to reproduce
sls deploy -s local
Results You Received:
Code will be minified as part of optimized packaging steps.
Results You Expected:
Code is not minified as part of optimized packaging steps.
Environment Details:
Serverless: 2.1.1
serverless-plugin-optimize: 4.1.4-rc.1
The text was updated successfully, but these errors were encountered: