@@ -56,9 +56,8 @@ const ENABLE_CACHING = isLocal ? config.options.caching : false;
5656
5757// Handle the "all" option in externals
5858// And add the forceExclude packages to it because they shouldn't be Webpacked
59- const computedExternals = ( externals === "all"
60- ? [ nodeExternals ( ) ]
61- : externals
59+ const computedExternals = (
60+ externals === "all" ? [ nodeExternals ( ) ] : externals
6261) . concat ( forceExclude ) ;
6362
6463const extensions = [
@@ -70,7 +69,7 @@ const extensions = [
7069 ".ts" ,
7170 ".tsx" ,
7271 ".graphql" ,
73- ".gql"
72+ ".gql" ,
7473] ;
7574
7675// If tsConfig is specified and not found, throw an error
@@ -133,7 +132,7 @@ function babelLoader() {
133132 "@babel/plugin-transform-runtime" ,
134133 "@babel/plugin-proposal-class-properties" ,
135134 "@babel/plugin-proposal-optional-chaining" ,
136- "@babel/plugin-proposal-nullish-coalescing-operator"
135+ "@babel/plugin-proposal-nullish-coalescing-operator" ,
137136 ] ;
138137
139138 if ( ENABLE_SOURCE_MAPS ) {
@@ -154,19 +153,19 @@ function babelLoader() {
154153 require . resolve ( "@babel/preset-env" ) ,
155154 {
156155 targets : {
157- node : nodeVersion
158- }
159- }
160- ]
161- ]
162- }
156+ node : nodeVersion ,
157+ } ,
158+ } ,
159+ ] ,
160+ ] ,
161+ } ,
163162 } ;
164163}
165164
166165function esbuildLoader ( loader ) {
167166 const options = {
168167 loader,
169- target : esbuildNodeVersion
168+ target : esbuildNodeVersion ,
170169 } ;
171170
172171 if ( ENABLE_TYPESCRIPT ) {
@@ -175,7 +174,7 @@ function esbuildLoader(loader) {
175174
176175 return {
177176 loader : "esbuild-loader" ,
178- options
177+ options,
179178 } ;
180179}
181180
@@ -187,16 +186,16 @@ function tsLoader() {
187186 configFile : tsConfigPath ,
188187 experimentalWatchApi : true ,
189188 // Don't check types if ForTsChecker is enabled
190- transpileOnly : ENABLE_TSCHECKER
191- }
189+ transpileOnly : ENABLE_TSCHECKER ,
190+ } ,
192191 } ;
193192}
194193
195194function loaders ( ) {
196195 const jsRule = {
197196 test : / \. j s $ / ,
198197 exclude : / n o d e _ m o d u l e s / ,
199- use : [ ENABLE_ESBUILD ? esbuildLoader ( "jsx" ) : babelLoader ( ) ]
198+ use : [ ENABLE_ESBUILD ? esbuildLoader ( "jsx" ) : babelLoader ( ) ] ,
200199 } ;
201200
202201 const loaders = {
@@ -207,13 +206,13 @@ function loaders() {
207206 include : / n o d e _ m o d u l e s / ,
208207 type : "javascript/auto" ,
209208 resolve : {
210- fullySpecified : false
211- }
209+ fullySpecified : false ,
210+ } ,
212211 } ,
213212 {
214213 test : / \. ( g r a p h q l | g q l ) $ / ,
215214 exclude : / n o d e _ m o d u l e s / ,
216- loader : "graphql-tag/loader"
215+ loader : "graphql-tag/loader" ,
217216 } ,
218217 {
219218 test : / \. c s s $ / ,
@@ -222,10 +221,10 @@ function loaders() {
222221 {
223222 loader : "css-loader" ,
224223 options : {
225- importLoaders : 1
226- }
227- }
228- ]
224+ importLoaders : 1 ,
225+ } ,
226+ } ,
227+ ] ,
229228 } ,
230229 {
231230 test : / \. s [ a c ] s s $ / i,
@@ -234,19 +233,23 @@ function loaders() {
234233 {
235234 loader : "css-loader" ,
236235 options : {
237- importLoaders : 1
238- }
236+ importLoaders : 1 ,
237+ } ,
239238 } ,
240239 {
241240 loader : "sass-loader" ,
242241 options : {
243- implementation : require ( "sass" )
244- }
245- }
246- ]
242+ implementation : require ( "sass" ) ,
243+ } ,
244+ } ,
245+ ] ,
247246 } ,
248- { test : / \. g i f | \. s v g | \. p n g | \. j p g | \. j p e g $ / , loader : "ignore-loader" }
249- ]
247+ { test : / \. g i f | \. s v g | \. p n g | \. j p g | \. j p e g $ / , loader : "ignore-loader" } ,
248+ {
249+ test : / \. n o d e $ / ,
250+ loader : "node-loader" ,
251+ } ,
252+ ] ,
250253 } ;
251254
252255 if ( ENABLE_TYPESCRIPT ) {
@@ -257,22 +260,22 @@ function loaders() {
257260 [
258261 path . resolve ( servicePath , "node_modules" ) ,
259262 path . resolve ( servicePath , ".serverless" ) ,
260- path . resolve ( servicePath , ".webpack" )
261- ]
262- ]
263+ path . resolve ( servicePath , ".webpack" ) ,
264+ ] ,
265+ ] ,
263266 } ;
264267
265268 loaders . rules . push ( tsRule ) ;
266269 }
267270
268271 if ( rawFileExtensions && rawFileExtensions . length ) {
269272 const rawFileRegex = `${ rawFileExtensions
270- . map ( rawFileExt => `\\.${ rawFileExt } ` )
273+ . map ( ( rawFileExt ) => `\\.${ rawFileExt } ` )
271274 . join ( "|" ) } $`;
272275
273276 loaders . rules . push ( {
274277 test : new RegExp ( rawFileRegex ) ,
275- loader : "raw-loader"
278+ loader : "raw-loader" ,
276279 } ) ;
277280 }
278281
@@ -298,8 +301,8 @@ function plugins() {
298301 const forkTsCheckerWebpackOptions = {
299302 typescript : {
300303 configFile : tsConfigPath ,
301- build : true
302- }
304+ build : true ,
305+ } ,
303306 } ;
304307
305308 if ( ENABLE_LINTING ) {
@@ -308,7 +311,7 @@ function plugins() {
308311 }
309312 forkTsCheckerWebpackOptions . eslint = {
310313 files : path . join ( servicePath , "**/*.ts" ) ,
311- options : { cwd : servicePath , baseConfig : tsEslintConfig }
314+ options : { cwd : servicePath , baseConfig : tsEslintConfig } ,
312315 } ;
313316 }
314317
@@ -320,7 +323,7 @@ function plugins() {
320323 new ESLintPlugin ( {
321324 context : servicePath ,
322325 baseConfig : jsEslintConfig ,
323- extensions : "js"
326+ extensions : "js" ,
324327 } )
325328 ) ;
326329
@@ -330,7 +333,7 @@ function plugins() {
330333 new ESLintPlugin ( {
331334 context : servicePath ,
332335 baseConfig : tsEslintConfig ,
333- extensions : [ "ts" ]
336+ extensions : [ "ts" ] ,
334337 } )
335338 ) ;
336339 }
@@ -339,22 +342,22 @@ function plugins() {
339342 if ( copyFiles ) {
340343 plugins . push (
341344 new CopyWebpackPlugin ( {
342- patterns : copyFiles . map ( function ( data ) {
345+ patterns : copyFiles . map ( function ( data ) {
343346 return {
344347 to : data . to ,
345348 context : servicePath ,
346- from : path . join ( servicePath , data . from )
349+ from : path . join ( servicePath , data . from ) ,
347350 } ;
348- } )
351+ } ) ,
349352 } )
350353 ) ;
351354
352355 // Copy file permissions
353356 const buildFiles = [ ] ;
354- copyFiles . forEach ( function ( data ) {
357+ copyFiles . forEach ( function ( data ) {
355358 const entries = fastGlob . sync ( [ data . from ] ) ;
356359 // loop through each file matched by fg
357- entries . forEach ( function ( entry ) {
360+ entries . forEach ( function ( entry ) {
358361 // get source file stat
359362 const stat = fs . statSync ( path . resolve ( servicePath , entry ) ) ;
360363 const { serverless } = slsw . lib ;
@@ -365,13 +368,13 @@ function plugins() {
365368 for ( let key in serverless . service . functions ) {
366369 buildFiles . push ( {
367370 fileMode : statModeToOctal ( stat . mode ) ,
368- path : path . resolve ( data . to , `.webpack/${ key } ` , entry )
371+ path : path . resolve ( data . to , `.webpack/${ key } ` , entry ) ,
369372 } ) ;
370373 }
371374 } else {
372375 buildFiles . push ( {
373376 fileMode : statModeToOctal ( stat . mode ) ,
374- path : path . resolve ( data . to , ".webpack/service" , entry )
377+ path : path . resolve ( data . to , ".webpack/service" , entry ) ,
375378 } ) ;
376379 }
377380 } ) ;
@@ -382,7 +385,7 @@ function plugins() {
382385 if ( concatText ) {
383386 const concatTextConfig = { } ;
384387
385- concatText . map ( function ( data ) {
388+ concatText . map ( function ( data ) {
386389 concatTextConfig . files = data . files || null ;
387390 concatTextConfig . name = data . name || null ;
388391 concatTextConfig . outputPath = data . outputPath || null ;
@@ -403,7 +406,7 @@ function plugins() {
403406 for ( let i = 0 , l = ignorePackages . length ; i < l ; i ++ ) {
404407 plugins . push (
405408 new webpack . IgnorePlugin ( {
406- resourceRegExp : new RegExp ( "^" + ignorePackages [ i ] + "$" )
409+ resourceRegExp : new RegExp ( "^" + ignorePackages [ i ] + "$" ) ,
407410 } )
408411 ) ;
409412 }
@@ -422,7 +425,7 @@ function resolvePlugins() {
422425 plugins . push (
423426 new TsconfigPathsPlugin ( {
424427 configFile : tsConfigPath ,
425- extensions : extensions
428+ extensions : extensions ,
426429 } )
427430 ) ;
428431 }
@@ -453,7 +456,7 @@ module.exports = {
453456 mode : isLocal ? "development" : "production" ,
454457 performance : {
455458 // Turn off size warnings for entry points
456- hints : false
459+ hints : false ,
457460 } ,
458461 resolve : {
459462 // Performance
@@ -463,7 +466,7 @@ module.exports = {
463466 // First start by looking for modules in the plugin's node_modules
464467 // before looking inside the project's node_modules.
465468 modules : [ path . resolve ( __dirname , "node_modules" ) , "node_modules" ] ,
466- plugins : resolvePlugins ( )
469+ plugins : resolvePlugins ( ) ,
467470 } ,
468471 // Add loaders
469472 module : loaders ( ) ,
@@ -473,7 +476,7 @@ module.exports = {
473476 nodeEnv : false ,
474477 splitChunks : false ,
475478 removeEmptyChunks : false ,
476- removeAvailableModules : false
479+ removeAvailableModules : false ,
477480 }
478481 : {
479482 nodeEnv : false ,
@@ -487,6 +490,6 @@ module.exports = {
487490 plugins : plugins ( ) ,
488491 experiments,
489492 node : {
490- __dirname : nodeDirname
491- }
493+ __dirname : nodeDirname ,
494+ } ,
492495} ;
0 commit comments