-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
35 lines (31 loc) · 782 Bytes
/
next.config.ts
File metadata and controls
35 lines (31 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import type { NextConfig } from "next";
import path from "node:path";
import fs from "node:fs";
const LOADER = path.resolve(__dirname, 'src/visual-edits/component-tagger-loader.js');
// Check if the loader file exists before using it
const loaderExists = fs.existsSync(LOADER);
const nextConfig: NextConfig = {
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
{
protocol: 'http',
hostname: '**',
},
],
},
// Only add turbopack rules if the loader exists and we're in development
...(loaderExists && process.env.NODE_ENV === 'development' && {
turbopack: {
rules: {
"*.{jsx,tsx}": {
loaders: [LOADER]
}
}
}
})
};
export default nextConfig;