From 8c5d31498ba297be71816e8ffbb24cde6e993f37 Mon Sep 17 00:00:00 2001 From: Phillweston <2436559745@qq.com> Date: Wed, 15 May 2024 12:34:14 +0000 Subject: [PATCH] Enable source map for development --- blog.config.js | 2 +- next.config.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/blog.config.js b/blog.config.js index 7c5faf6c..3a30ddea 100644 --- a/blog.config.js +++ b/blog.config.js @@ -540,7 +540,7 @@ const BLOG = { process.env.ENABLE_CACHE || process.env.npm_lifecycle_event === 'build' || process.env.npm_lifecycle_event === 'export', // 在打包过程中默认开启缓存,开发或运行时开启此功能意义不大。 - isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) + isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小 VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号 } diff --git a/next.config.js b/next.config.js index d8a6c2ba..20a1c311 100644 --- a/next.config.js +++ b/next.config.js @@ -165,6 +165,10 @@ const nextConfig = { 'themes', THEME ) + // Enable source maps in development mode + if (process.env.NODE_ENV_API === 'development') { + config.devtool = 'source-map' + } return config }, experimental: { @@ -181,7 +185,6 @@ const nextConfig = { }, publicRuntimeConfig: { // 这里的配置既可以服务端获取到,也可以在浏览器端获取到 - NODE_ENV_API: process.env.NODE_ENV_API || 'prod', THEMES: themes } }