2022-02-15 08:43:11 +01:00
|
|
|
const { withSentryConfig } = require('@sentry/nextjs')
|
2022-08-08 08:21:36 +02:00
|
|
|
const path = require('path')
|
2022-02-15 08:43:11 +01:00
|
|
|
|
2023-07-11 15:35:39 +02:00
|
|
|
const landingPagePaths = [
|
|
|
|
'/',
|
|
|
|
'/pricing',
|
|
|
|
'/privacy-policies',
|
|
|
|
'/terms-of-service',
|
|
|
|
'/about',
|
|
|
|
'/oss-friends',
|
|
|
|
]
|
|
|
|
|
2022-08-08 08:21:36 +02:00
|
|
|
/** @type {import('next').NextConfig} */
|
2023-03-15 08:35:16 +01:00
|
|
|
const nextConfig = {
|
2022-08-08 08:21:36 +02:00
|
|
|
reactStrictMode: true,
|
2023-03-15 08:35:16 +01:00
|
|
|
transpilePackages: [
|
|
|
|
'@typebot.io/lib',
|
|
|
|
'@typebot.io/schemas',
|
|
|
|
'@typebot.io/emails',
|
|
|
|
],
|
2022-08-08 08:21:36 +02:00
|
|
|
output: 'standalone',
|
2022-03-12 07:53:37 +01:00
|
|
|
experimental: {
|
2022-08-08 08:21:36 +02:00
|
|
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
2022-03-12 07:53:37 +01:00
|
|
|
},
|
2023-03-21 14:09:46 +01:00
|
|
|
async rewrites() {
|
2023-07-11 15:35:39 +02:00
|
|
|
return {
|
|
|
|
beforeFiles: (process.env.LANDING_PAGE_URL
|
|
|
|
? landingPagePaths
|
|
|
|
.map((path) => ({
|
|
|
|
source: '/_next/static/:static*',
|
|
|
|
destination: `${process.env.LANDING_PAGE_URL}/_next/static/:static*`,
|
|
|
|
has: [
|
|
|
|
{
|
|
|
|
type: 'header',
|
|
|
|
key: 'referer',
|
|
|
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}))
|
|
|
|
.concat(
|
|
|
|
landingPagePaths.map((path) => ({
|
|
|
|
source: '/typebots/:typebot*',
|
|
|
|
destination: `${process.env.LANDING_PAGE_URL}/typebots/:typebot*`,
|
|
|
|
has: [
|
|
|
|
{
|
|
|
|
type: 'header',
|
|
|
|
key: 'referer',
|
|
|
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
.concat(
|
|
|
|
landingPagePaths.map((path) => ({
|
|
|
|
source: '/styles/:style*',
|
|
|
|
destination: `${process.env.LANDING_PAGE_URL}/styles/:style*`,
|
|
|
|
has: [
|
|
|
|
{
|
|
|
|
type: 'header',
|
|
|
|
key: 'referer',
|
|
|
|
value: `${process.env.NEXT_PUBLIC_VIEWER_URL}${path}`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
.concat(
|
|
|
|
landingPagePaths.map((path) => ({
|
|
|
|
source: path,
|
|
|
|
destination: `${process.env.LANDING_PAGE_URL}${path}`,
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
: []
|
|
|
|
).concat({
|
2023-03-21 09:11:36 +01:00
|
|
|
source: '/api/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
|
|
|
destination:
|
|
|
|
'/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url',
|
2023-07-11 15:35:39 +02:00
|
|
|
}),
|
|
|
|
}
|
2023-03-21 09:11:36 +01:00
|
|
|
},
|
2023-03-15 08:35:16 +01:00
|
|
|
}
|
2022-02-15 08:43:11 +01:00
|
|
|
|
|
|
|
const sentryWebpackPluginOptions = {
|
2022-08-08 08:21:36 +02:00
|
|
|
silent: true,
|
2023-02-06 09:48:48 +01:00
|
|
|
release: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA + '-viewer',
|
2022-02-15 08:43:11 +01:00
|
|
|
}
|
|
|
|
|
2022-12-20 10:05:30 +01:00
|
|
|
module.exports = process.env.NEXT_PUBLIC_SENTRY_DSN
|
|
|
|
? withSentryConfig(
|
|
|
|
{
|
|
|
|
...nextConfig,
|
|
|
|
sentry: {
|
|
|
|
hideSourceMaps: true,
|
2023-02-14 15:09:05 +01:00
|
|
|
widenClientFileUpload: true,
|
2022-12-20 10:05:30 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
sentryWebpackPluginOptions
|
|
|
|
)
|
|
|
|
: nextConfig
|