Migrating from serverless-webpack
I would like to migrate my project from serverless-webpack to this plugin. There are some points I would like to discuss. It seems this repository is actively maintained, so we might find ways to increase the developer experience.
I didn't have the time to investigate yet, but the following two points are mandatory to me for seriously considering the migration, and I didn't see them in the documentation:
- make sure the integration with serverless-offline works seamlessly
- offer an alternative to the
webpackIncludeModulesoption. It should leverage theyarn.lockfile to produce deterministic bundles when possible 👌 (and fallback to npm)
I would be happy to contribute in anyway I could 👍
Hello @aymericbeaumet,
Thank you for your message.
I'm currently not using serverless-offline in my projects, have you tried it already with this plugin ?
Regarding the webpackIncludeModules option, what do you want to achieve exactly ? I'm currently following this PR https://github.com/serverless/serverless/pull/3737, have you seen it ?
I did not try to use your plugin along with serverless-offline yet, but as far as I understand you have to explicitly hook on the appropriate events to be able to build the bundle at the appropriate moment. serverless-webpack seems to do it here.
Its webpackIncludeModules option allows to include the webpack externals modules inside the build. More precisely it performs npm install [email protected] [email protected] with the external modules (using the versions from the package.json). That's why I was mentioning yarn, which could be used instead when a yarn.lock is found. I don't know if it's possible to only specify a specific list of packages in that case though (yarn add a b).
https://github.com/serverless/serverless/pull/3737 seems to address a different issue, which would be complementary to the webpackIncludeModules approach. It allows to exclude dev dependencies from the build.