👷 Transpile components for better DX
This commit is contained in:
committed by
Baptiste Arnaud
parent
898367a33b
commit
c1dd4d403e
@@ -1,56 +1,60 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true',
|
||||
})
|
||||
const withTM = require('next-transpile-modules')(['utils', 'models'])
|
||||
|
||||
const pages = ['pricing', 'privacy-policies', 'terms-of-service', 'about']
|
||||
|
||||
module.exports = withBundleAnalyzer({
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: '/typebot-lib',
|
||||
destination:
|
||||
'https://unpkg.com/typebot-js@2.0.21/dist/index.umd.min.js',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/typebot-lib/v2',
|
||||
destination: 'https://unpkg.com/typebot-js@2.1.3/dist/index.umd.min.js',
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
},
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
module.exports = withTM(
|
||||
withBundleAnalyzer({
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: '/_next/static/:static*',
|
||||
source: '/typebot-lib',
|
||||
destination:
|
||||
process.env.NEXT_PUBLIC_VIEWER_URL + '/_next/static/:static*',
|
||||
has: [
|
||||
{
|
||||
type: 'header',
|
||||
key: 'referer',
|
||||
value:
|
||||
process.env.LANDING_PAGE_HOST +
|
||||
'/(?!' +
|
||||
pages.join('|') +
|
||||
'|\\?).+',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
fallback: [
|
||||
{
|
||||
source: '/:typebotId*',
|
||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/:typebotId*',
|
||||
'https://unpkg.com/typebot-js@2.0.21/dist/index.umd.min.js',
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/api/:path*',
|
||||
source: '/typebot-lib/v2',
|
||||
destination:
|
||||
'https://unpkg.com/typebot-js@2.1.3/dist/index.umd.min.js',
|
||||
permanent: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
})
|
||||
]
|
||||
},
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
{
|
||||
source: '/_next/static/:static*',
|
||||
destination:
|
||||
process.env.NEXT_PUBLIC_VIEWER_URL + '/_next/static/:static*',
|
||||
has: [
|
||||
{
|
||||
type: 'header',
|
||||
key: 'referer',
|
||||
value:
|
||||
process.env.LANDING_PAGE_HOST +
|
||||
'/(?!' +
|
||||
pages.join('|') +
|
||||
'|\\?).+',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
fallback: [
|
||||
{
|
||||
source: '/:typebotId*',
|
||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/:typebotId*',
|
||||
},
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/api/:path*',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user