You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

next.config.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* eslint-disable no-undef */
  2. /* eslint-disable @typescript-eslint/no-var-requires */
  3. const withPWA = require('next-pwa')
  4. const {
  5. GITHUB_ID,
  6. GITHUB_SECRET,
  7. GITHUB_API_SECRET,
  8. NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN,
  9. SENTRY_ORG,
  10. SENTRY_PROJECT,
  11. SENTRY_AUTH_TOKEN,
  12. NODE_ENV,
  13. VERCEL_GIT_COMMIT_SHA,
  14. GA_MEASUREMENT_ID,
  15. } = process.env
  16. process.env.SENTRY_DSN = SENTRY_DSN
  17. const isProduction = NODE_ENV === 'production'
  18. const basePath = ''
  19. module.exports = withPWA({
  20. productionBrowserSourceMaps: true,
  21. env: {
  22. NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA,
  23. GA_MEASUREMENT_ID,
  24. GITHUB_ID,
  25. GITHUB_SECRET,
  26. GITHUB_API_SECRET,
  27. },
  28. webpack: (config, options) => {
  29. if (!options.isServer) {
  30. config.resolve.alias['@sentry/node'] = '@sentry/browser'
  31. }
  32. config.plugins.push(
  33. new options.webpack.DefinePlugin({
  34. 'process.env.NEXT_IS_SERVER': JSON.stringify(options.isServer.toString()),
  35. })
  36. )
  37. if (
  38. SENTRY_DSN &&
  39. SENTRY_ORG &&
  40. SENTRY_PROJECT &&
  41. SENTRY_AUTH_TOKEN &&
  42. VERCEL_GIT_COMMIT_SHA &&
  43. isProduction
  44. ) {
  45. config.plugins.push(
  46. new SentryWebpackPlugin({
  47. include: '.next',
  48. ignore: ['node_modules'],
  49. stripPrefix: ['webpack://_N_E/'],
  50. urlPrefix: `~${basePath}/_next`,
  51. release: VERCEL_GIT_COMMIT_SHA,
  52. authToken: SENTRY_AUTH_TOKEN,
  53. org: SENTRY_PROJECT,
  54. project: SENTRY_ORG,
  55. })
  56. )
  57. }
  58. return config
  59. },
  60. basePath,
  61. pwa: {
  62. disable: !isProduction,
  63. dest: 'public',
  64. },
  65. reactStrictMode: true,
  66. webpack5: true,
  67. symlinks: false,
  68. })