serverless-bundle
serverless-bundle copied to clipboard
Don't use tsconfig-paths-webpack-plugin if no baseUrl defined
We have a typescript project with no baseUrl
defined in compilerOptions
, which causes errors like the following when bundling:
Packaging [redacted] for stage staging (us-east-1)
Failed to load /[redacted]/tsconfig.json: Missing baseUrl in compilerOptions
Bundling with Webpack...
tsconfig-paths-webpack-plugin: Found no baseUrl in tsconfig.json, not applying tsconfig-paths-webpack-plugin
tsconfig-paths-webpack-plugin: Found no baseUrl in tsconfig.json, not applying tsconfig-paths-webpack-plugin
tsconfig-paths-webpack-plugin: Found no baseUrl in tsconfig.json, not applying tsconfig-paths-webpack-plugin
...
This PR changes the webpack config to skip adding tsconfig-paths-webpack-plugin
if no baseUrl is defined.
To test it, I added a flag to the runSlsCommand
helper, that includes stderr output (as well as stdout) in the returned string.
You might want to do something different there but this seemed like the smallest possible change.