@@ -6,45 +6,39 @@ const PATH_DELIMITER = '[\\\\/]' // match 2 antislashes or one slash
66 * paths of the modules. So we need to check for \\ and /
77 */
88// @ts -ignore
9- const safePath = module => module . split ( / [ \\ \/ ] / g) . join ( PATH_DELIMITER )
9+ const safePath = ( module ) => module . split ( / [ \\ \/ ] / g) . join ( PATH_DELIMITER )
1010
1111/**
1212 * Actual Next.js plugin
1313 */
1414
1515const withPrismaPlugin = ( nextConfig = { } ) => (
16- phase :
17- | "phase-export"
18- | "phase-production-build"
19- | "phase-production-server"
20- | "phase-development-server" ,
21- thing : any
16+ phase : 'phase-export' | 'phase-production-build' | 'phase-production-server' | 'phase-development-server' ,
17+ thing : any
2218) => {
23- if ( phase === " phase-development-server" ) {
19+ if ( phase === ' phase-development-server' ) {
2420 return Object . assign ( { } , nextConfig , {
2521 webpack ( config : any , options : any ) {
2622 const ignore = [ '.prisma/client' , '@prisma/client' ]
2723
2824 // const includes = ignore.map(module => (new RegExp(`${module}(?!.*node_modules)`)));
29- const excludes = [ new RegExp ( `node_modules(?!/(${ ignore . join ( '|' ) } )(?!.*node_modules))` ) ] ;
30- const ignored = config . watchOptions . ignored . filter (
31- ( ignored : string ) => ignored !== '**/node_modules/**'
32- ) . concat ( excludes ) ;
25+ const excludes = [ new RegExp ( `node_modules(?!/(${ ignore . join ( '|' ) } )(?!.*node_modules))` ) ]
26+ const ignored = config . watchOptions . ignored
27+ . filter ( ( ignored : string ) => ignored !== '**/node_modules/**' )
28+ . concat ( excludes )
3329 return Object . assign ( config , {
3430 plugins : [ ...config . plugins , new PrismaClientReloaderWebpackPlugin ( ) ] ,
3531 watchOptions : {
3632 ...config . watchOptions ,
37- ignored
38- }
33+ ignored,
34+ } ,
3935 } )
40- }
36+ } ,
4137 } )
4238 }
43- let internalConfigObj =
44- typeof nextConfig === "function"
45- ? nextConfig ( phase , thing )
46- : nextConfig ;
47- return internalConfigObj ;
39+ let internalConfigObj = typeof nextConfig === 'function' ? nextConfig ( phase , thing ) : nextConfig
40+ return internalConfigObj
4841}
4942
5043module . exports = withPrismaPlugin
44+ export default withPrismaPlugin
0 commit comments