Skip to content

Commit

Permalink
minift
Browse files Browse the repository at this point in the history
  • Loading branch information
feedthejim committed Jun 26, 2023
1 parent cc65f01 commit 4e544ba
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/next/src/build/webpack-config.ts
Expand Up @@ -2729,6 +2729,7 @@ export default async function getBaseWebpackConfig(
experimental: config.experimental,
disableStaticImages: config.images.disableStaticImages,
transpilePackages: config.transpilePackages,
enableSourceMapsForServer: config.enableSourceMapsForServer,
})

// @ts-ignore Cache exists
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack/config/blocks/base.ts
Expand Up @@ -35,7 +35,7 @@ export const base = curry(function base(
} else {
if (
ctx.isEdgeRuntime ||
ctx.isServer ||
(ctx.isServer && ctx.enableSourceMapsForServer) ||
// Enable browser sourcemaps:
(ctx.productionBrowserSourceMaps && ctx.isClient)
) {
Expand Down
3 changes: 3 additions & 0 deletions packages/next/src/build/webpack/config/index.ts
Expand Up @@ -25,6 +25,7 @@ export async function buildConfiguration(
transpilePackages,
experimental,
disableStaticImages,
enableSourceMapsForServer,
}: {
hasAppDir: boolean
supportedBrowsers: string[] | undefined
Expand All @@ -41,6 +42,7 @@ export async function buildConfiguration(
future: NextConfigComplete['future']
experimental: NextConfigComplete['experimental']
disableStaticImages: NextConfigComplete['disableStaticImages']
enableSourceMapsForServer: NextConfigComplete['enableSourceMapsForServer']
}
): Promise<webpack.Configuration> {
const ctx: ConfigurationContext = {
Expand All @@ -64,6 +66,7 @@ export async function buildConfiguration(
transpilePackages,
future,
experimental,
enableSourceMapsForServer,
}

let fns = [base(ctx), css(ctx)]
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/build/webpack/config/utils.ts
Expand Up @@ -22,6 +22,7 @@ export type ConfigurationContext = {

sassOptions: any
productionBrowserSourceMaps: boolean
enableSourceMapsForServer: boolean

transpilePackages: NextConfigComplete['transpilePackages']

Expand Down
3 changes: 3 additions & 0 deletions packages/next/src/server/config-schema.ts
Expand Up @@ -203,6 +203,9 @@ const configSchema = {
disableServerMinification: {
type: 'boolean',
},
enableSourceMapsForServer: {
type: 'boolean',
},
env: {
type: 'object',
},
Expand Down
6 changes: 6 additions & 0 deletions packages/next/src/server/config-shared.ts
Expand Up @@ -459,6 +459,11 @@ export interface NextConfig extends Record<string, any> {
*/
disableServerMinification?: boolean

/**
* Enables source maps generation for the server production bundle.
*/
enableSourceMapsForServer?: boolean

/**
* Next.js exposes some options that give you some control over how the server will dispose or keep in memory built pages in development.
*
Expand Down Expand Up @@ -646,6 +651,7 @@ export const defaultConfig: NextConfig = {
analyticsId: process.env.VERCEL_ANALYTICS_ID || '',
images: imageConfigDefault,
disableServerMinification: false,
enableSourceMapsForServer: false,
devIndicators: {
buildActivity: true,
buildActivityPosition: 'bottom-right',
Expand Down

0 comments on commit 4e544ba

Please sign in to comment.