Next.js Discord

Discord Forum
","url":"https://nextjs-forum.com/post/1141121496610250772#message-1141153829493153943","dateCreated":"2023-08-15T23:37:55.000Z","author":{"@type":"Person","name":"kylemh"}}}}

Polyfill Chunk Error in Next.js 12

Unanswered
kylemh posted this in #help-forum
Open in Discord
Hello! We use LogRocket to record our users' sessions, and we're noticing a GET request that has a failure response in almost every session. The request is to mycompany.com/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js and is initiated via a script tag.

How can I prevent these failures? Why is this happening?

1 Reply

I checked out the Next.js repo at v12.3.4 and see the following code:

isClient &&
        new CopyFilePlugin({
          filePath: require.resolve('./polyfills/polyfill-nomodule'),
          cacheKey: process.env.__NEXT_VERSION as string,
          name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
          minimize: false,
          info: {
            [CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL]: 1,
            // This file is already minified
            minimized: true,
          },
        }),


Somehow this ends up as a <script> tag with a src value that has no available target.

<script defer="" nomodule="" src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script>