decomp.me icon indicating copy to clipboard operation
decomp.me copied to clipboard

[CHORE] `ANALYZE=true yarn build` fails due to svg packing

Open mkst opened this issue 6 months ago • 0 comments

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: null.

This is the frog.svg, which is handled (along wth all svgs) in the next.config.js

        webpack(config) {
            config.module.rules.push({
                test: /\.svg$/,
                use: ["@svgr/webpack"],
            });

but for some reason adding ANALYZE=true causes this to fail.

Full log:

# ANALYZE=true yarn build
yarn run v1.22.22
$ next build
 ⚠ Invalid next.config.js options detected: 
 ⚠     Unrecognized key(s) in object: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config
   ▲ Next.js 15.3.2
   - Experiments (use with caution):
     · clientTraceMetadata

   Creating an optimized production build ...
Webpack Bundle Analyzer saved report to /frontend/.next/analyze/nodejs.html
Webpack Bundle Analyzer saved report to /frontend/.next/analyze/edge.html
Webpack Bundle Analyzer saved report to /frontend/.next/analyze/client.html
 ⚠ Compiled with warnings in 66s

./node_modules/vscode-languageserver-types/lib/umd/main.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Import trace for requested module:
./node_modules/vscode-languageserver-types/lib/umd/main.js
./node_modules/vscode-languageserver-protocol/lib/common/api.js
./node_modules/vscode-languageserver-protocol/lib/node/main.js
./src/lib/codemirror/languageServer.ts
./src/components/Scratch/hooks/useLanguageServer.ts
./src/components/Scratch/Scratch.tsx
./src/components/Scratch/index.ts
./src/app/scratch/[slug]/ScratchEditor.tsx

 ✓ Linting and checking validity of types    
 ⚠ Using edge runtime on a page currently disables static generation for that page
 ✓ Collecting page data 
Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: null.
    at nH (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:64717)
    at nW (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:67762)
    at nz (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:65337)
    at nW (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:68001)
    at nz (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:65337)
    at nY (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:71193)
    at nX (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:69876)
    at nW (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:68029)
    at nz (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:65337)
    at nY (/frontend/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:71193)
Export encountered an error on /_not-found/page: /_not-found, exiting the build.
 ⨯ Next.js build worker exited with code: 1 and signal: null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

mkst avatar Jun 14 '25 09:06 mkst