@@ -7,14 +7,15 @@ const service = require('./service');
77 * Sets webpack entry
88 * @param {object } fn Serverless function object
99 * @param {string } servicePath Serverless service path
10+ * @param {boolean } useTypeScript Use .ts extension
1011 * @returns {object } Webpack configuration
1112 */
12- const setEntry = ( fn , servicePath ) =>
13+ const setEntry = ( fn , servicePath , useTypeScript ) =>
1314 R . assoc (
1415 'entry' ,
1516 R . objOf (
16- service . fnPath ( fn ) ,
17- path . join ( servicePath , service . fnPath ( fn ) )
17+ service . fnPath ( '.js' ) ( fn ) ,
18+ path . join ( servicePath , service . fnPath ( useTypeScript ? '.ts' : '.js' ) ( fn ) )
1819 )
1920 ) ;
2021
@@ -40,13 +41,14 @@ const setOutput = (defaultOutput, outputPath) =>
4041 * @param {string } servicePath Serverless service path
4142 * @param {object } defaultOutput Webpack default output object
4243 * @param {string } folder Webpack output folder
44+ * @param {boolean } useTypeScript Use .ts extension
4345 * @returns {array } Array of webpack configurations
4446 */
45- const createConfigs = ( fns , config , servicePath , defaultOutput , folder ) =>
47+ const createConfigs = ( fns , config , servicePath , defaultOutput , folder , useTypeScript ) =>
4648 R . map (
4749 fn =>
4850 R . pipe (
49- setEntry ( fn , servicePath ) ,
51+ setEntry ( fn , servicePath , useTypeScript ) ,
5052 setOutput ( defaultOutput , path . join ( servicePath , folder ) )
5153 ) ( config ) ,
5254 R . values ( fns )
0 commit comments