-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
145 lines (134 loc) · 4.09 KB
/
next.config.js
File metadata and controls
145 lines (134 loc) · 4.09 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// DO NOT EDIT THIS FILE
import { createRequire } from 'module';
import createNextIntlPlugin from 'next-intl/plugin';
// Create a require function to use with ES modules
const require = createRequire(import.meta.url);
// Create the Next.js Intl plugin
const withNextIntl = createNextIntlPlugin();
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
trailingSlash: false,
experimental: {
allowedDevOrigins: [
'*.cloudworkstations.dev',
'3000-idx-automaigit-1741768452810.cluster-4ezwrnmkojawstf2k7vqy36oe6.cloudworkstations.dev',
],
esmExternals: true, // Enable ESM in external packages
},
assetPrefix: process.env.ASSET_PREFIX || '',
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'lh3.googleusercontent.com',
},
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
},
],
unoptimized: true,
},
webpack: (config) => {
config.externals = config.externals || [];
config.externals.push({
'utf-8-validate': 'commonjs utf-8-validate',
bufferutil: 'commonjs bufferutil',
bcrypt: 'commonjs bcrypt',
'@mapbox/node-pre-gyp': 'commonjs @mapbox/node-pre-gyp',
'oidc-token-hash': 'commonjs oidc-token-hash',
});
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
dns: false,
npm: false,
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
path: require.resolve('path-browserify'),
buffer: require.resolve('buffer'),
};
config.module = config.module || {};
config.module.exprContextCritical = false;
config.ignoreWarnings = [
{ module: /node_modules\/ssh2\/lib\/protocol\/constants\.js/ },
{ module: /node_modules\/ssh2\/lib\/protocol\/crypto\.js/ },
{ module: /node_modules\/@mapbox\/node-pre-gyp/ },
{ module: /node_modules\/bcrypt/ },
{ module: /node_modules\/oidc-token-hash/ },
{ module: /node_modules\/openid-client/ },
{ message: /should not be imported directly/ },
/Critical dependency: the request of a dependency is an expression/,
/Module not found: Can't resolve 'ws'/,
/export 'default' \(imported as 'RFB'\) was not found in/,
];
// Update noVNC handling for top-level await
config.module.rules.push({
test: /node_modules\/@novnc\/novnc\/lib\/.*\.js$/,
type: 'javascript/auto', // Ensure it's treated as JavaScript
resolve: {
fullySpecified: false, // Allow importing without extensions
},
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: { browsers: ['last 2 versions', 'not dead'] },
modules: false, // Preserve ES modules
useBuiltIns: 'usage',
corejs: 3,
},
],
],
plugins: [
'@babel/plugin-syntax-import-assertions',
'@babel/plugin-syntax-top-level-await',
],
},
},
});
// Enable top-level await in webpack
config.experiments = {
...config.experiments,
topLevelAwait: true,
};
// Add support for isomorphic-git in browser
config.resolve.alias = {
...config.resolve.alias,
'@isomorphic-git/lightning-fs': '@isomorphic-git/lightning-fs',
};
// Monaco Editor webpack configuration
config.module.rules.push({
test: /\.worker\.js$/,
use: { loader: 'worker-loader' },
});
// Ensure Monaco Editor workers are handled correctly
config.output = {
...config.output,
globalObject: 'self',
};
return config;
},
serverExternalPackages: [
'ws',
'ssh2',
'bcrypt',
'@mapbox/node-pre-gyp',
'oidc-token-hash',
'openid-client',
],
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
};
// Export the configuration using ES module syntax
export default withNextIntl(nextConfig);