Skip to content

Commit

Permalink
use modularize imports to speed up hot compile on dev (#4597)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth authored Feb 10, 2025
1 parent 3ab9adc commit eac76d8
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const FRAME_ANCESTORS = [
'https://nance.app',
'https://jbdao.org',
'https://nounspace.com',
'https://*.nounspace.com'
'https://*.nounspace.com',
]

if (process.env.NODE_ENV === 'development') {
Expand Down Expand Up @@ -127,8 +127,42 @@ const SECURITY_HEADERS = [

/** @type {import('next').NextConfig} */
const nextConfig = removeImports({
modularizeImports: {
'@heroicons/react/20/solid': {
transform: '@heroicons/react/20/solid/{{member}}',
},
'@heroicons/react/20/outline': {
transform: '@heroicons/react/20/outline/{{member}}',
},
'@heroicons/react/24/solid': {
transform: '@heroicons/react/24/solid/{{member}}',
},
'@heroicons/react/24/outline': {
transform: '@heroicons/react/24/outline/{{member}}',
},
lodash: {
transform: 'lodash/{{member}}',
},
antd: {
transform: 'antd/es/{{member}}',
},
'@headlessui/react': {
transform: '@headlessui/react/{{member}}',
},
},
experimental: {
esmExternals: true,
optimizePackageImports: [
// TODO: For whatever reason, doesnt work on current version of next (^14.2.10)
// TODO: once on a later version, replace the modularizeImports with this
// '@heroicons/react/20/solid',
// '@heroicons/react/20/outline',
// '@heroicons/react/24/solid',
// '@heroicons/react/24/outline',
// 'lodash',
// 'antd',
// '@headlessui/react',
],
},
staticPageGenerationTimeout: 90,
webpack: config => {
Expand Down

0 comments on commit eac76d8

Please sign in to comment.