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

Add @visx/visx to the import optimization list #54778

Merged
merged 2 commits into from
Aug 30, 2023
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
1 change: 1 addition & 0 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ function assignDefaults(
'@heroicons/react/20/solid',
'@heroicons/react/24/solid',
'@heroicons/react/24/outline',
'@visx/visx',
]),
]

Expand Down
6 changes: 6 additions & 0 deletions test/development/basic/barrel-optimization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('optimizePackageImports', () => {
'lucide-react': '0.264.0',
'@headlessui/react': '1.7.17',
'@heroicons/react': '2.0.18',
'@visx/visx': '3.3.0',
},
})
})
Expand Down Expand Up @@ -117,4 +118,9 @@ describe('optimizePackageImports', () => {
const html = await next.render('/recursive')
expect(html).toContain('<h1>42</h1>')
})

it('should support visx', async () => {
const html = await next.render('/visx')
expect(html).toContain('<linearGradient')
})
})
10 changes: 10 additions & 0 deletions test/development/basic/barrel-optimization/pages/visx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Gradient } from '@visx/visx'

export default function Page() {
return (
<svg width={400} height={400}>
<Gradient.GradientPinkBlue id="g" from="red" to="blue" />
<rect width={400} height={400} fill="url(#g)" />
</svg>
)
}