Skip to content

Commit

Permalink
紧跟版本的痛啊;
Browse files Browse the repository at this point in the history
1. react@18 下 font-optimization 有 BUG, Temporary fix:
optimizeFonts: false; vercel/next.js#35835 (comment)
2. next@12.1.5 swcMinify 有 BUG, 12.1.4 还是好的, Temporary fix:
swcMinify: false; vercel/next.js#36127 (comment)
3. 当前 next@12.1.5 和 @sentry/nextjs@6.19.6 的情况有 BUG, 不会上传 sourcemap 不知道以前是否是好; getsentry/sentry-javascript#3579 (comment)
  • Loading branch information
powerfulyang committed Apr 16, 2022
1 parent 4a3a0cf commit d7469b7
Show file tree
Hide file tree
Showing 14 changed files with 1,585 additions and 108 deletions.
1 change: 1 addition & 0 deletions .dockerignore
@@ -1,4 +1,5 @@
node_modules/
.git/
.idea/
.sentryclirc

3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -35,3 +35,6 @@ public/workbox-*.js

next-env.d.ts


# Sentry
.sentryclirc
43 changes: 38 additions & 5 deletions next.config.js
@@ -1,16 +1,33 @@
const withPWA = require('next-pwa');
const withPlugins = require('next-compose-plugins');
const withCamelCaseCSSModules = require('./plugins/next-css-modules');
const { isDevProcess } = require('@powerfulyang/utils');
const { isDevProcess, isProdProcess } = require('@powerfulyang/utils');
const runtimeCaching = require('next-pwa/cache');
const { withSentryConfig } = require('@sentry/nextjs');

/**
* @type {string}
*/
const API_ENV = process.env.API_ENV;

const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore

silent: false, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

const excludeCacheNames = ['next-data', 'apis'];

const defaultCacheRule = runtimeCaching.filter((x) => {
return !excludeCacheNames.includes(x.options.cacheName);
});

const API_ENV = process.env.API_ENV;
if (API_ENV === 'prod') {
process.env.CLIENT_BASE_URL = 'https://api.powerfulyang.com/api';
process.env.SERVER_BASE_URL = 'https://api.powerfulyang.com/api';
Expand Down Expand Up @@ -88,16 +105,32 @@ const config = {
esmExternals: true,
},
env: {
CLIENT_BASE_URL: process.env.CLIENT_BASE_URL || '',
CLIENT_BASE_URL: process.env.CLIENT_BASE_URL,
NEXT_PUBLIC_SENTRY_DSN:
'https://f4e15b44f3674255b6eed1cb673c0dcb@o417744.ingest.sentry.io/6340260',
},
eslint: {
ignoreDuringBuilds: true, //不用自带的
},
reactStrictMode: true,
swcMinify: true,
typescript: {
ignoreBuildErrors: true,
},
sentry: {
disableServerWebpackPlugin: isDevProcess,
disableClientWebpackPlugin: isDevProcess,
},
productionBrowserSourceMaps: isProdProcess,
optimizeFonts: false,
swcMinify: false,
};

module.exports = withPlugins([[withCamelCaseCSSModules], [withPWA], [withBundleAnalyzer]], config);
module.exports = withPlugins(
[
withCamelCaseCSSModules,
withPWA,
withBundleAnalyzer,
[withSentryConfig, sentryWebpackPluginOptions],
],
config,
);

0 comments on commit d7469b7

Please sign in to comment.