Unverified Commit 8698b492 authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

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)
parent a33d5022
...@@ -2084,12 +2084,12 @@ export default async function (task) { ...@@ -2084,12 +2084,12 @@ export default async function (task) {
await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts) await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts)
await task.watch('trace/**/*.+(js|ts|tsx)', 'trace', opts) await task.watch('trace/**/*.+(js|ts|tsx)', 'trace', opts)
await task.watch( 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', 'shared_re_exported',
opts opts
) )
await task.watch( await task.watch(
'shared/**/!(amp|config|constants|dynamic|head).+(js|ts|tsx)', 'shared/**/!(amp|config|constants|dynamic|head|runtime-config).+(js|ts|tsx)',
'shared', 'shared',
opts opts
) )
...@@ -2104,7 +2104,8 @@ export default async function (task) { ...@@ -2104,7 +2104,8 @@ export default async function (task) {
export async function shared(task, opts) { export async function shared(task, opts) {
await task await task
.source( .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 }) .swc('client', { dev: opts.dev })
.target('dist/shared') .target('dist/shared')
...@@ -2114,7 +2115,8 @@ export async function shared(task, opts) { ...@@ -2114,7 +2115,8 @@ export async function shared(task, opts) {
export async function shared_re_exported(task, opts) { export async function shared_re_exported(task, opts) {
await task await task
.source( .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 }) .swc('client', { dev: opts.dev, interopClientDefaultExport: true })
.target('dist/shared') .target('dist/shared')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment