serverless-webpack icon indicating copy to clipboard operation
serverless-webpack copied to clipboard

forceExclude should apply to peerDependencies

Open danobri opened this issue 4 years ago • 2 comments

This is a (Feature Proposal)

Description

  • What is the use case that should be solved? The forceExclude option currently only applies to devDependencies, but peerDependencies is a more appropriate place for aws-sdk. Putting it in devDependencies is a violation of the following lint rule: https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md Can serverless-webpack be updated so that forceExclude also applies to peerDependencies?

  • If there is additional config how would it look No additional config required

Related issue(s):

  • #393

Additional Data

  • Serverless-Webpack Version you're using:5.5.5
  • Webpack version you're using:5.60.0
  • Serverless Framework Version you're using:2.64.1
  • Operating System:Mac BigSur 11.6
  • Stack Trace (if available): N/A

danobri avatar Oct 26 '21 22:10 danobri

This is a breaking change, so we'd better have good reasons for that. PRs are welcomed.

Otherwise you may switch to a custom webpack.config.js to gain more control on which sections in package.json to exclude with webpack-node-externals, see the modulesFromFile#excludeFromBundle option.

vicary avatar Nov 01 '21 19:11 vicary

Well, I would think forceExclude is the equivalent to "trust me bro, I know what I'm doing". Would allow me to nicely get rid of typescript and all the other stuff I don't want bundled and provide a nice escape hatch to all the issues brought by peerDependencies being bundled in

NPellet avatar Nov 17 '22 12:11 NPellet