Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mixed exports in server component with barrel optimization #64894

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/next/src/build/webpack/loaders/next-barrel-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ async function getBarrelMapping(
if (targetMatches) {
// Merge the export list
exportList = exportList.concat(targetMatches.exportList)
// Inherit the client boundary from the target matched file
isClientEntry = isClientEntry || targetMatches.isClientEntry
}
})
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { buttonStyle, Button } from 'mixed-lib'

export default function Page() {
return (
<div>
<Button id="component" style={buttonStyle()} />
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ describe('Skipped in Turbopack', () => {
},
({ next }) => {
it('should build successfully', async () => {
// Ensure that MUI is working
const $ = await next.render$('/')
expect(await $('#client-mod').text()).toContain('client:default')
})

it('should handle mixed imports from barrel optimized lib correctly', async () => {
const $ = await next.render$('/mixed-barrel-imports')
expect(await $('#component').attr('style')).toContain('color:blue')
})
}
)
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
experimental: {
optimizePackageImports: ['my-lib'],
optimizePackageImports: ['my-lib', 'mixed-lib'],
},
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading