Add next config for react email dev server

This commit is contained in:
MartinBraquet
2026-03-01 19:12:30 +01:00
parent 75a689707d
commit 4a4bee658d
3 changed files with 31 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
/** @type {import('next').NextConfig} */
// eslint-disable-next-line
const path = require('path')
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
experimental: {
serverComponentsExternalPackages: [
'@react-email/components',
'@react-email/render',
'@react-email/tailwind',
],
externalDir: true, // compile files that are located next to the .react-email directory
},
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
common: path.resolve(__dirname, '../../common/lib'),
shared: path.resolve(__dirname, '../shared/lib'),
email: path.resolve(__dirname, './emails'),
}
return config
},
}
module.exports = nextConfig

View File

@@ -4,7 +4,9 @@
"private": true,
"scripts": {
"build": "tsc -b",
"predev": "cp next.config.js .react-email/next.config.js",
"dev": "email dev --port 3001",
"postinstall": "echo 'Setting up email dev, stop the process when it says that react email is ready and then run yarn dev' && yarn dev",
"lint": "npx eslint . --max-warnings 0",
"lint-fix": "npx eslint . --fix",
"test": "jest --config jest.config.ts --passWithNoTests",

View File

@@ -1,17 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// Use / as the root for tests so path-mapped imports from
// ../shared and ../../common are within the configured rootDir.
// This avoids TS6059 during ts-jest compilation.
"rootDir": "../..",
"rootDir": ".",
"baseUrl": ".",
"paths": {
"api/*": ["src/*"],
"shared/*": ["../shared/src/*"],
"common/*": ["../../common/src/*"],
"email/*": ["../email/emails/*"]
"email/*": ["./emails/*"]
}
},
"include": ["tests/**/*.ts", "src/**/*.ts"]
"include": ["tests/**/*.ts", "emails/**/*.ts", "emails/**/*.tsx"]
}