Repository navigation
Add support for webpack configuration in TypeScript format - #129
Conversation
|
Shouldn't we detect whether a TypeScript format configuration is being used before loading |
|
I agree with @hassankhan . Unconditionally requiring |
|
I was thinking of something more lo-fi like checking the file extension, either way sounds good 👍 |
|
I originally had the I wouldn't worry about any side effects, since ts-node actually does hook into |
|
@jussikinnula Any update here? |
|
Updated version of the patch is now on top of latest upstream master! I tested with my Angular starter project, and works (e.g. |
| this.options = options; | ||
|
|
||
| if ( | ||
| this.serverless.service |
There was a problem hiding this comment.
Could these perhaps use Lodash's has() instead? Something like:
if (
_.has(this.serverless.service, 'custom.webpack')
&& _.endsWith(this.serverless.service.custom.webpack, '.ts')
) {
...
}There was a problem hiding this comment.
.. and lodash's _.endsWith() 😄
|
Aside from the one thing mentioned, this looks good to go! 👍 |
|
I didn't want to add any extra dependencies besides |
|
That's a valid point. We can do a "lodash"ification as a completely separate branch/PR and switch the code to use it everywhere, not only here. I will create a task for that, so that we get the whole codebase a bit leaner. |
To add support for webpack configuration in TypeScript format (e.g. webpack.config.ts), there's an existing package
ts-nodewhich just does the magic.Webpack uses this method also internally, if specifying configuration file to webpack by using
webpack --config webpack.config.ts. But sinceserverless-webpackdoes require the configuration by using a "require",ts-nodeneeds to be required to support on-the-fly.ts-file requires.