Repository navigation
Expand file tree
/
Copy pathnext.config.mjs
More file actions
66 lines (54 loc) · 1.76 KB
/
Copy pathnext.config.mjs
File metadata and controls
66 lines (54 loc) · 1.76 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
import path from "path";
import { fileURLToPath } from "url";
// 固定为配置文件所在目录,避免从 D:\AutoTest 启动时解析到错误目录找不到 tailwindcss
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const projectRoot = __dirname;
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
output: "standalone",
turbopack: {},
webpack: (config, { dev }) => {
const nodeModules = path.join(projectRoot, "node_modules");
// 将 webpack context 固定到项目根目录
config.context = projectRoot;
config.resolve = config.resolve || {};
// 模块搜索路径:优先本项目 node_modules
config.resolve.modules = [nodeModules, "node_modules"];
// 强制 tailwindcss 解析到本项目 node_modules 下的 CSS 入口文件
config.resolve.alias = {
...config.resolve.alias,
tailwindcss$: path.join(nodeModules, "tailwindcss", "index.css"),
tailwindcss: path.join(nodeModules, "tailwindcss"),
};
// 为 CSS @import 设置独立的解析路径,确保在任何 cwd 下都能找到模块
config.resolve.fallback = {
...config.resolve.fallback,
};
if (dev) {
config.watchOptions = {
...config.watchOptions,
ignored: [
"**/node_modules/**",
"**/logs/**",
"**/prisma/dev.db",
"**/prisma/dev.db-journal",
"**/.git/**",
"**/executor/**/*.log",
"**/executor/venv/**",
"**/proxy-server/venv/**",
],
};
}
return config;
},
allowedDevOrigins: [
"http://192.168.10.113:3009",
"http://localhost:3009",
"http://127.0.0.1:3009",
],
typescript: {
ignoreBuildErrors: true,
},
};
export default nextConfig;