How to use Typescript's references and build mode to compile a mono repo to a serverless bundle?

旧时模样 提交于 2019-12-06 06:45:00

If it works for you to generate a single output file and use a module loader, you can use outFile and prepend.

If you want multiple output files, maybe it's worth filing a suggestion to ask for an option to bundle dependencies in that case; you would be the second person who has asked about this on Stack Overflow today. Edit: Suggestion is here.

Edit 2: After extensive discussion, the conclusion was to enable the nohoist option on the final Yarn workspace, which gives us symlinks from node_modules to the other workspaces. After we call tsc -b in the final workspace, the Serverless packaging tool follows the symlinks and produces a zip file with the correct structure. No bundling is needed at the TypeScript level. Caveat: Yarn seems to install devDependencies of dependencies in the final workspace, which seems wrong to me and confuses Serverless into unnecessarily including those modules in the bundle.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!