Can't use `optimizePackageImports` because it causes rendering errors
jahirfiquitiva opened this issue · comments
Jahir Fiquitiva commented
If I add optimizePackageImports: ['react-tweet'],
to my next.config.js
it will cause the following error, breaking the page rendering
Error: (0 , _barrel_optimize_names_QuotedTweet_TweetActions_TweetBody_TweetContainer_TweetHeader_TweetInReplyTo_TweetInfo_TweetMedia_enrichTweet_react_tweet__WEBPACK_IMPORTED_MODULE_1__.enrichTweet) is not a function
at CustomTweet (webpack-internal:///(rsc)/./src/components/ui/blog/mdx/tweet/custom-tweet.tsx:11:208)
at eD (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:359300)
at e (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:365057)
at e8 (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:365554)
at e8 (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:365706)
at ta (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:371259)
at ti (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:371973)
at Timeout._onTimeout (/Users/jahir/dev/jahir/website/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.dev.js:35:360498)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
Luis Alvarez D. commented
Why are you adding react-tweet
to optimizePackageImports
?
Jahir Fiquitiva commented
@lfades I certainly am not sure 😅 ... I copied the config from another repo that used it which had it. Probably to reduce the client bundle, but I think it might not be needed anymore 🤔😬