-
Notifications
You must be signed in to change notification settings - Fork 34
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
[FEAT] nx-serverless - add ability to exclude modules from generated package.json #48
Comments
I am also looking to see a way to force exclude packages that we managed in the layers. Our package size is going bigger (around 20-30mb) and we have around 5-10 functions per service, so we really need this feature. |
@jamesgroat are you able to share code snippets? |
hmm ... we can do so by adding it into |
I think adding to serverless.yml is better (the serverless-webpack plugin applies the same approach), it to avoid all services that are affected when modifying the angular.json or workspace.json. By the way, what is your idea on how to turn off the packager in the nx-serverless and use another (i.e. serverless-webpack)? |
hmm the reason i built this packagr is to make it work with nx and serverless-webpack obsolete. I think a better approach is how to allow custom webpack configurations using the same packagr? The webpack part is actually using the angular builders, and packagr is just used to prune the packages to make it small and robust. 😄 |
Custom webpack.config.js file is already supported now by nx-serverless. but we want to add some customization per service (on serverless.yml file) such as forceExclude, forceInclude, toggle package.individually option (seems not to work now) |
I think that can be fix in the packagr itself ... Rather do it that way ... Lets draft it out, I will have a session or two this month to re-work on the bugs/enhancements that are there in the repo |
Have to get the forceexludes from the serverless config here in |
Will this be implemented soon? This is an essential feature IMO and sounds like a simple fix. Would be great to have an option for the build builder to exclude a list of packages. I've had to manually edit This is an awesome plugin btw 🙏 |
About this Most importantly, an option like this in Using an option in the {
"build": {
"executor": "@flowaccount/nx-serverless:build",
"configurations": {
"dev-offline": {
"excludeNodeModules": false
},
"production-offline": {
"excludeNodeModules": false
},
"production-no-deps": {
"excludeNodeModules": true
}
}
},
"serve": {
"executor": "@flowaccount/nx-serverless:offline",
"configurations": {
"dev": {
"buildTarget": "myApp:build:dev-offline"
},
"production": {
"buildTarget": "myApp:build:production-offline"
}
}
},
"deploy": {
"executor": "@flowaccount/nx-serverless:deploy",
"options": {
"buildTarget": "myApp:build:production-no-deps"
}
}
} |
I'd like to be able to exclude modules from the serverless deploy package. I have layers setup that include a lot of modules that I use across multiple functions.
I'd like to be able to specify excluded modules in the build options. There is a
forceExcludes
parameter passed to getProdModules that is always passed in as an empty array[]
.nx-plugins/libs/nx-serverless/src/utils/normalize.ts
Line 236 in 0efe67a
In addition
forceExcludes
is only used to avoid throwing an error if a runtime dependency is in devDependencies.nx-plugins/libs/nx-serverless/src/utils/normalize.ts
Line 314 in 0efe67a
I propose that we add
forceExcludes
to build options and not add those modules to the created package.json.Check which provider is affected:
[X] AWS
[X] Azure
[X] Google Cloud Platform
Check which framework is affected:
[] Angular
[] Nodejs
[X] Serverless
[] Lambda
[] Infrastructure as a code
Additional context
I've tested deploys w/ the modules that I have in my layer removed from the package.json and it works as expected. Doing this takes my individual function bundle sizes down from 12.8mb each to a few kb.
The text was updated successfully, but these errors were encountered: