dougmoscrop/serverless-plugin-include-dependencies

New Serverless Package Pattern Seems to Break Plugin

jon-flowers opened this issue · 0 comments

Hello,
I updated to a newer version of Serverless (2.38) in one of my projects recently, and received deprecation warnings advising about the change to packaging includes/excludes (replacing them with the pattern method) - https://www.serverless.com/framework/docs/deprecations#new-way-to-define-packaging-patterns

I try to stay on top of these deprecations, so I updated my repo to use the new method.

Original Package Section

package: 
    exclude: # Specify the directories and files which should be excluded in the deployment package
        - ./**

    include:
        - package.json
        - package-lock.json
        - src/**
        - '*.js'
        - '*.html'
    excludeDevDependencies: false # Recommended setting for serverless-plugin-include-dependencies

New (Not-Working) Package Section

package: 
    patterns:
        - '!./**' #Excludes (!) all by default before including the files below
        - 'package.json'
        - 'package-lock.json'
        - 'src/**'
        - '*.js'
        - '*.html'
    excludeDevDependencies: false # Recommended setting for serverless-plugin-include-dependencies

Based on the deprecation warning this new patterns section should be the equivalent of the old exclude / include.

However, when I deployed with serverless, my node_modules folder disappeared entirely. With the "old" include/exclude the plugin worked successfully and included the right modules, but with the change to patterns it appears that this plugin is no longer functioning as expected. I was able to "fix" this and have my node_modules included again by disabling the plugin entirely, and changing my packaging section to the bwlo:

New (Working) Package Section
package:
patterns:
- '!./' #Excludes (!) all by default before including the files below
- 'package.json'
- 'package-lock.json'
- 'src/
'
- '.js'
- '
.html'
- 'node_modules/**'
excludeDevDependencies: true

Obviously this includes the full node_modules directory now, so I lose some of the space-saving benefits of the plugin.

Does the plugin need to be updated to account for the new package method from the framework?

Thank you