2021-07-20 18:25:36 +00:00
/* eslint-disable @typescript-eslint/no-var-requires */
2021-11-03 14:02:17 +00:00
const withTM = require ( "@vercel/edge-functions-ui/transpile" ) ( [ "react-timezone-select" ] ) ;
2021-09-23 08:49:17 +00:00
const { i18n } = require ( "./next-i18next.config" ) ;
2021-04-26 12:01:21 +00:00
2021-09-21 20:18:41 +00:00
// So we can test deploy previews preview
if ( process . env . VERCEL _URL && ! process . env . BASE _URL ) {
2021-09-22 18:36:13 +00:00
process . env . BASE _URL = "https://" + process . env . VERCEL _URL ;
2021-09-21 20:18:41 +00:00
}
if ( process . env . BASE _URL ) {
process . env . NEXTAUTH _URL = process . env . BASE _URL + "/api/auth" ;
2021-06-07 16:38:46 +00:00
}
2021-09-22 18:36:13 +00:00
if ( ! process . env . NEXT _PUBLIC _APP _URL ) {
process . env . NEXT _PUBLIC _APP _URL = process . env . BASE _URL ;
}
2021-09-28 08:04:30 +00:00
process . env . NEXT _PUBLIC _BASE _URL = process . env . BASE _URL ;
2021-06-07 16:38:46 +00:00
2021-07-20 18:18:26 +00:00
if ( ! process . env . EMAIL _FROM ) {
console . warn (
"\x1b[33mwarn" ,
"\x1b[0m" ,
"EMAIL_FROM environment variable is not set, this may indicate mailing is currently disabled. Please refer to the .env.example file."
) ;
2021-05-27 22:10:20 +00:00
}
2021-05-04 20:31:15 +00:00
const validJson = ( jsonString ) => {
2021-07-20 18:18:26 +00:00
try {
const o = JSON . parse ( jsonString ) ;
if ( o && typeof o === "object" ) {
return o ;
2021-05-04 20:31:15 +00:00
}
2021-07-20 18:18:26 +00:00
} catch ( e ) {
console . error ( e ) ;
}
return false ;
} ;
2021-05-04 20:31:15 +00:00
2021-07-20 18:18:26 +00:00
if ( process . env . GOOGLE _API _CREDENTIALS && ! validJson ( process . env . GOOGLE _API _CREDENTIALS ) ) {
console . warn (
"\x1b[33mwarn" ,
"\x1b[0m" ,
'- Disabled \'Google Calendar\' integration. Reason: Invalid value for GOOGLE_API_CREDENTIALS environment variable. When set, this value needs to contain valid JSON like {"web":{"client_id":"<clid>","client_secret":"<secret>","redirect_uris":["<yourhost>/api/integrations/googlecalendar/callback>"]}. You can download this JSON from your OAuth Client @ https://console.cloud.google.com/apis/credentials.'
) ;
2021-05-04 20:31:15 +00:00
}
2021-10-20 09:08:58 +00:00
const plugins = [ ] ;
if ( process . env . ANALYZE === "true" ) {
// only load dependency if env `ANALYZE` was set
const withBundleAnalyzer = require ( "@next/bundle-analyzer" ) ( {
enabled : true ,
} ) ;
plugins . push ( withBundleAnalyzer ) ;
}
plugins . push ( withTM ) ;
2021-09-29 14:36:58 +00:00
// prettier-ignore
module . exports = ( ) => plugins . reduce ( ( acc , next ) => next ( acc ) , {
2021-09-23 08:49:17 +00:00
i18n ,
2021-09-02 14:33:05 +00:00
eslint : {
// This allows production builds to successfully complete even if the project has ESLint errors.
ignoreDuringBuilds : true ,
} ,
2021-04-07 20:05:23 +00:00
typescript : {
ignoreBuildErrors : true ,
} ,
2021-09-09 13:51:06 +00:00
webpack : ( config ) => {
config . resolve . fallback = {
... config . resolve . fallback , // if you miss it, all the other options in fallback, specified
// by next.js will be dropped. Doesn't make much sense, but how it is
fs : false ,
} ;
return config ;
} ,
2021-05-07 15:04:56 +00:00
async redirects ( ) {
return [
{
2021-07-20 18:18:26 +00:00
source : "/settings" ,
destination : "/settings/profile" ,
2021-05-07 15:04:56 +00:00
permanent : true ,
2021-07-20 18:18:26 +00:00
} ,
2021-09-29 21:33:18 +00:00
{
source : "/bookings" ,
destination : "/bookings/upcoming" ,
permanent : true ,
} ,
2021-07-20 18:18:26 +00:00
] ;
} ,
2021-04-26 12:01:21 +00:00
} ) ;