Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
52 lines (44 loc) · 1.99 KB

File metadata and controls

52 lines (44 loc) · 1.99 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
Copyright 2020-2026 Lowdefy, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import fs from 'node:fs';
import path from 'node:path';
// Patch next.config.js for the local monorepo dev environment.
//
// The isolated _server/ copy has its own pnpm-workspace.yaml and lockfile.
// Next.js 16 detects multiple lockfiles and warns about the workspace root.
// Setting outputFileTracingRoot tells Next.js where the real root is.
//
// Turbopack's resolveAlias does not handle absolute paths (it prepends "./"),
// so we resolve paths relative to __dirname at runtime in next.config.js.
function patchNextConfig({ targetDir }) {
const nextConfigPath = path.join(targetDir, 'next.config.js');
let content = fs.readFileSync(nextConfigPath, 'utf8');
// Silence the "multiple lockfiles" warning by telling Next.js the
// monorepo root is the output file tracing root.
if (content.includes('turbopack: {},')) {
content = content.replace(
'turbopack: {},',
[
`outputFileTracingRoot: require('path').resolve(__dirname, '../..'),`,
` turbopack: {`,
` resolveAlias: {`,
` react: './' + require('path').relative(__dirname, require('path').dirname(require.resolve('react/package.json'))),`,
` 'react-dom': './' + require('path').relative(__dirname, require('path').dirname(require.resolve('react-dom/package.json'))),`,
` },`,
` },`,
].join('\n')
);
}
fs.writeFileSync(nextConfigPath, content);
}
export default patchNextConfig;
Morty Proxy This is a proxified and sanitized view of the page, visit original site.