From 8698b4927cdf82773812ae2461919255644945db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Tue, 6 Sep 2022 04:13:56 +0200 Subject: [PATCH] fix: apply default export interop to `next/config` (#40224) The `next/config` code generated is incompatible with the `type: "module"` setting in `package.json`. This PR makes sure that we append the same interop code to the output `shared/lib/runtime-config` file as other re-exported modules: https://github.com/vercel/next.js/blob/93830bf04f1f40e1996f21a3534b6010d9ef3c0c/packages/next/taskfile-swc.js#L124-L128 Fixes #40159 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples) --- packages/next/taskfile.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index fa6f5c186a1f..8bd7d046f2d0 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -2084,12 +2084,12 @@ export default async function (task) { await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts) await task.watch('trace/**/*.+(js|ts|tsx)', 'trace', opts) await task.watch( - 'shared/lib/{amp,config,constants,dynamic,head}.+(js|ts|tsx)', + 'shared/lib/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)', 'shared_re_exported', opts ) await task.watch( - 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)', + 'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)', 'shared', opts ) @@ -2104,7 +2104,8 @@ export default async function (task) { export async function shared(task, opts) { await task .source( - opts.src || 'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)' + opts.src || + 'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)' ) .swc('client', { dev: opts.dev }) .target('dist/shared') @@ -2114,7 +2115,8 @@ export async function shared(task, opts) { export async function shared_re_exported(task, opts) { await task .source( - opts.src || 'shared/**/{amp,config,constants,dynamic,head}.+(js|ts|tsx)' + opts.src || + 'shared/**/{amp,config,constants,dynamic,head,runtime-config}.+(js|ts|tsx)' ) .swc('client', { dev: opts.dev, interopClientDefaultExport: true }) .target('dist/shared')