2021-07-20 15:25:36 -03:00
/* eslint-disable @typescript-eslint/no-var-requires */
2021-11-03 11:02:17 -03:00
const withTM = require ( "@vercel/edge-functions-ui/transpile" ) ( [ "react-timezone-select" ] ) ;
2021-09-23 05:49:17 -03:00
const { i18n } = require ( "./next-i18next.config" ) ;
2021-04-26 09:01:21 -03:00
2021-09-21 17:18:41 -03:00
// So we can test deploy previews preview
if ( process . env . VERCEL _URL && ! process . env . BASE _URL ) {
2021-09-22 15:36:13 -03:00
process . env . BASE _URL = "https://" + process . env . VERCEL _URL ;
2021-09-21 17:18:41 -03:00
}
if ( process . env . BASE _URL ) {
process . env . NEXTAUTH _URL = process . env . BASE _URL + "/api/auth" ;
2021-06-07 13:38:46 -03:00
}
2021-09-22 15:36:13 -03:00
if ( ! process . env . NEXT _PUBLIC _APP _URL ) {
process . env . NEXT _PUBLIC _APP _URL = process . env . BASE _URL ;
}
2021-09-28 05:04:30 -03:00
process . env . NEXT _PUBLIC _BASE _URL = process . env . BASE _URL ;
2021-06-07 13:38:46 -03:00
2021-07-20 15:18:26 -03: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 19:10:20 -03:00
}
2021-05-04 17:31:15 -03:00
const validJson = ( jsonString ) => {
2021-07-20 15:18:26 -03:00
try {
const o = JSON . parse ( jsonString ) ;
if ( o && typeof o === "object" ) {
return o ;
2021-05-04 17:31:15 -03:00
}
2021-07-20 15:18:26 -03:00
} catch ( e ) {
console . error ( e ) ;
}
return false ;
} ;
2021-05-04 17:31:15 -03:00
2021-07-20 15:18:26 -03: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 17:31:15 -03:00
}
2021-10-20 06:08:58 -03: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 11:36:58 -03:00
// prettier-ignore
module . exports = ( ) => plugins . reduce ( ( acc , next ) => next ( acc ) , {
2021-09-23 05:49:17 -03:00
i18n ,
2021-09-02 11:33:05 -03:00
eslint : {
// This allows production builds to successfully complete even if the project has ESLint errors.
ignoreDuringBuilds : true ,
} ,
2021-04-07 17:05:23 -03:00
typescript : {
ignoreBuildErrors : true ,
} ,
2021-09-09 10:51:06 -03: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 12:04:56 -03:00
async redirects ( ) {
return [
{
2021-07-20 15:18:26 -03:00
source : "/settings" ,
destination : "/settings/profile" ,
2021-05-07 12:04:56 -03:00
permanent : true ,
2021-07-20 15:18:26 -03:00
} ,
2021-09-29 18:33:18 -03:00
{
source : "/bookings" ,
destination : "/bookings/upcoming" ,
permanent : true ,
} ,
2021-07-20 15:18:26 -03:00
] ;
} ,
2021-04-26 09:01:21 -03:00
} ) ;