2
0

👷 Transpile components for better DX

This commit is contained in:
Baptiste Arnaud
2022-09-18 09:46:42 +02:00
committed by Baptiste Arnaud
parent 898367a33b
commit c1dd4d403e
147 changed files with 343 additions and 485 deletions

View File

@@ -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*',
},
],
}
},
})
)

View File

@@ -13,14 +13,14 @@
"@emotion/react": "11.10.4",
"@emotion/styled": "11.10.4",
"aos": "^2.3.4",
"bot-engine": "*",
"bot-engine": "workspace:*",
"focus-visible": "^5.2.0",
"framer-motion": "7.3.2",
"models": "*",
"models": "workspace:*",
"next": "12.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"utils": "*"
"utils": "workspace:*"
},
"devDependencies": {
"@babel/core": "7.19.0",
@@ -36,6 +36,7 @@
"eslint": "8.23.0",
"eslint-config-next": "12.3.0",
"eslint-plugin-react": "^7.31.8",
"next-transpile-modules": "^9.0.0",
"postcss": "8.4.16",
"prettier": "2.7.1",
"typescript": "^4.8.3"