Skip to content

Commit

Permalink
fix: apply default export interop to next/config (#40224)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
balazsorban44 committed Sep 6, 2022
1 parent a33d502 commit 8698b49
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/next/taskfile.js
Expand Up @@ -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
)
Expand All @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit 8698b49

Please sign in to comment.