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

How can the test directory be excluded from webpack packaging? #67

Open
ramanbuttar opened this issue Aug 25, 2017 · 4 comments
Open

How can the test directory be excluded from webpack packaging? #67

ramanbuttar opened this issue Aug 25, 2017 · 4 comments

Comments

@ramanbuttar
Copy link

Right now, my test directory code is getting included in the webpack package built and uploaded to AWS Lambda. How can I exclude this directory? I tried different things from https://webpack.github.io/docs/configuration.html but none have helped so far.

@brianjd
Copy link

brianjd commented Sep 4, 2017

@ramanbuttar If I am understanding your issue correctly, it is actually tackled in your core serverless config. See this documentation.

package:
  exclude:
    - node_modules/**
    - your_test_directory/**

@ramanbuttar
Copy link
Author

@brianjd I tried the above but my expect statements from test/ directory are still being included in my webpack'd and zipped handler.js file. I don't need to have that code in AWS Lambda.

@mpuittinen
Copy link
Contributor

@brianjd
Copy link

brianjd commented Sep 11, 2017

@ramanbuttar @mpuittinen Approach looks solid, it dynamically generates entry points for each function using the serverless config. Therefore avoiding the tests being bundled, especially if you previously had broad directory inclusion / entry points.

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

3 participants