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

New Serverless Package Pattern Seems to Break Plugin #65

Open
jon-flowers opened this issue Apr 23, 2021 · 0 comments
Open

New Serverless Package Pattern Seems to Break Plugin #65

jon-flowers opened this issue Apr 23, 2021 · 0 comments

Comments

@jon-flowers
Copy link

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

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