Closed justinasit closed 2 years ago
Hi @justinasit,
Sorry for the delay. This issue totally missed my radar.
Did you solve your issue?
This library works by creating a wrapper function that requires all your middlewares and chain them. It does not move around your files so your references should be valid.
This might be an issue between the webpack and the middleware plugin.
Hi @juanjoDiaz,
No worries, unfortunately I did not solve it! Ended up changing all the dynamic imports to static ones as they were small files anyways, so not a huge issue.
Have you or anyone else managed to successfully use dynamic imports with serverless-middleware? We're using "serverless-bundle" v4.4.0 to do all the webpack magic. Maybe it has something to do with that.
I was able to do this successfully, although I did not use serverless-webpack
, I used a combination of two plugins.
- serverless-plugin-common-excludes
- serverless-plugin-include-dependencies
My full plugin list and order and the inclusion of the external dependancies:
plugins:
- serverless-plugin-typescript
- serverless-plugin-common-excludes
- serverless-plugin-include-dependencies
- serverless-middleware
- serverless-offline
package:
excludeDevDependencies: false
patterns:
- 'node_modules/@srd/app-common-apis/middleware/**' # adds my custom node module as an external dependency of the build
- 'node_modules/@srd/**/middleware/**'
Hi,
I've encountered an issue today when using "serverless-middleware". The plugin works well in general, but I cannot seem to do any dynamic imports in my app using "import()".
The problem is that the path in the compiled app changes to "/.middleware", but the imports are file in the level below. Here is an example error:
In this case the "8.js" would be in "/usr/src/app/services/accounts/.webpack/service/" and not in "/usr/src/app/services/accounts/.webpack/service/.middleware/".
Is there any known work around to this?
Thank you.