next.js
eba364a9 - Emit polyfill-nomodule.js into the build manifest polyfillFiles (#65223)

Commit
1 year ago
Emit polyfill-nomodule.js into the build manifest polyfillFiles (#65223) ### Why? `polyfill-nomodule.js` is a pre-built file containing polyfills for older browsers (gated by the `<script>` tag `nomodule` attribute). ### How? - The turbopack server needs to emit a raw OutputAsset for this file, so that it is copied into the output chunks directory. - That file needs to be passed into `polyfillFiles`, and preserved when we're merging manifests inside of the development server. ### Test Plan ``` HEADLESS=true pnpm testonly-dev test/e2e/app-dir/app/index.test.ts -t 'should serve polyfills for browsers that do not support modules' HEADLESS=true pnpm testonly-dev-turbo test/e2e/app-dir/app/index.test.ts -t 'should serve polyfills for browsers that do not support modules' ``` Build a project with `next dev --turbo` and inspect: ![Screenshot 2024-05-01 at 10.40.39 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/fe0214b2-ca56-4c03-a133-921f1dc51775.png) ![Screenshot 2024-05-01 at 10.40.20 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/d41dbf91-34d2-44c4-90ec-30e3212ce0f8.png) Verify that the polyfill file exists and resolves in the browser. Closes PACK-2993
Author
bgw bgw
Parents
Loading