Skip to content

Commit

Permalink
chore: optimize the next.config configuration and remove unnecessary …
Browse files Browse the repository at this point in the history
…environment variable files
  • Loading branch information
xingwanying committed Jan 8, 2025
1 parent 3a58c99 commit 6e98497
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 85 deletions.
2 changes: 0 additions & 2 deletions client/.env.example

This file was deleted.

7 changes: 5 additions & 2 deletions client/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
SELF_PATH=/client/
NEXT_PUBLIC_API_DOMAIN=http://localhost:8001
NODE_ENV="development"

NEXT_PUBLIC_API_DOMAIN="http://127.0.0.1:8000"

NEXT_STANDALONE="true"
47 changes: 17 additions & 30 deletions client/next.config.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
// const withBundleAnalyzer = require('@next/bundle-analyzer')({
// enabled: process.env.ANALYZE === 'true',
// })
// module.exports = withBundleAnalyzer({})
const { withSentryConfig } = require("@sentry/nextjs");


const nextConfig = {
...process.env.NEXT_STANDALONE ? { output: "standalone" } :{},
webpack: (config, { dev}) => {
...process.env.NEXT_STANDALONE ? { output: "standalone" } : {}, // Standalone configuration
webpack: (config, { dev }) => {
config.resolve.fallback = { http: false, https: false, net: false, tls: false };

if (dev) {
config.watchOptions = {
followSymlinks: true,
}
};

config.snapshot.managedPaths = [];
}

// Add markdown loader
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader',
});

return config;
}
},
};

// Make sure adding Sentry options is the last code to run before exporting
module.exports = withSentryConfig(nextConfig, {

const sentryOptions = {
org: "petercat",
project: "petercat",

// An auth token is required for uploading source maps.
authToken: process.env.SENTRY_AUTH_TOKEN,

silent: false, // Can be used to suppress logs

authToken: process.env.SENTRY_AUTH_TOKEN,
silent: false,
hideSourceMaps: true,

sourcemaps: {
disable: true,
},
});

module.exports = {
output: "standalone",
webpack: (config) => {
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader',
});

return config;
},
};

module.exports = withSentryConfig(nextConfig, sentryOptions);
6 changes: 3 additions & 3 deletions docs/guides/self_hosted_local.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ docker compose pull
docker compose up -d
```

### Step 4: Copy the `.env.example` Files
### Step 4: Copy the `.env.local.example` Files
Copy the client environment configuration example file:
```bash
cp client/.env.local.example client/.env
cp client/.env.local.example client/.env.local
```

Copy the server environment configuration example file:
Expand Down Expand Up @@ -104,4 +104,4 @@ yarn run client
```

Verify the client service by opening `http://127.0.0.1:3000` in your browser.
```
```
4 changes: 2 additions & 2 deletions docs/guides/self_hosted_local_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ docker compose pull
docker compose up -d
```

### 第四步:复制 `.env.example` 文件
### 第四步:复制 `.env.local.example` 文件
复制客户端环境配置示例文件:
```bash
cp client/.env.local.example client/.env
cp client/.env.local.example client/.env.local
```

复制服务器环境配置示例文件:
Expand Down
46 changes: 0 additions & 46 deletions server/.env.example

This file was deleted.

0 comments on commit 6e98497

Please sign in to comment.