rsnext/test/e2e
Houssein Djirdeh 79016b879f
Adds web worker support to <Script /> using Partytown (#34244)
## Summary

This PR adds a new `worker` strategy to the `<Script />` component that automatically relocates and executes the script in a web worker.

```jsx
<Script 
  strategy="worker"
  ...
/>
```

[Partytown](https://partytown.builder.io/) is used under the hood to provide this functionality.

## Behavior

- This will land as an experimental feature and will only work behind an opt-in flag in `next.config.js`:

  ```js
  experimental: {
    nextScriptWorkers: true
  }
  ```

- This setup use a similar approach to how ESLint and Typescript is used in Next.js by showing an error to the user to install the dependency locally themselves if they've enabled the experimental `nextScriptWorkers` flag.

  <img width="1068" alt="Screen Shot 2022-03-03 at 2 33 13 PM" src="https://user-images.githubusercontent.com/12476932/156639227-42af5353-a2a6-4126-936e-269112809651.png">
- For Partytown to work, a number of static files must be served directly from the site (see [docs](https://partytown.builder.io/copy-library-files)). In this PR, these files are automatically copied to a `~partytown` directory in `.next/static` during `next build` and `next dev` if the `nextScriptWorkers` flag is set to true.

## Checklist

- [X] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [X] Related issues linked using `fixes #number`
- [X] Integration tests added
- [X] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

This PR fixes #31517.
2022-03-11 22:26:46 +00:00
..
basepath fix popstate detection for safari when basepath is present (#32687) 2021-12-21 14:11:10 -06:00
browserslist-extends Ensure browserslist extends works properly (#33890) 2022-02-02 13:23:51 -06:00
config-promise-export Add support for async fn / promise in next.config.js/.mjs (#33662) 2022-02-07 08:48:35 +00:00
dynamic-route-interpolation Bug fix: dynamic page should not be interpreted as predefined page (#33808) 2022-02-02 02:57:04 +00:00
getserversideprops Ensure invalid request to static page is handled correctly (#34346) 2022-02-15 11:28:18 -06:00
i18n-api-support Ensure non-matching API routes can be rewritten (#33966) 2022-03-01 15:53:25 -05:00
middleware-can-use-wasm-files Expose WASM bindings in Middleware (#34437) 2022-03-02 15:09:36 +00:00
next-head Fix non-concurrent function _document (#31628) 2021-11-19 19:41:19 +00:00
next-script-worker-strategy Adds web worker support to <Script /> using Partytown (#34244) 2022-03-11 22:26:46 +00:00
nonce-head-manager correctly assess node equality when nonce attribute is present (#27573) 2021-11-10 19:31:32 -06:00
prerender Update to re-use cache while revalidate is erroring (#34931) 2022-03-02 14:09:40 -08:00
prerender-native-module Migrate prerender tests to new set-up (#29245) 2021-09-21 16:21:05 +02:00
type-module-interop Add support for "type": "module" in package.json (#33637) 2022-02-15 16:24:11 +00:00
yarn-pnp/test [examples] Update styled-components to use SWC (#34770) 2022-03-02 03:43:34 +01:00
basepath-trailing-slash.test.ts Ensure trailingSlash is correct for index with query (#29217) 2021-09-21 16:18:42 +02:00
basepath.test.ts Fix pre-compiled check from copying react-refresh-utils (#33442) 2022-01-18 18:49:26 +00:00
example.txt Add util for generating new tests/error documents (#33001) 2022-01-06 09:45:04 -06:00
prerender-crawler.test.ts Add crawler blocking for fallback: true (#29121) 2021-09-16 11:01:28 -05:00
prerender-native-module.test.ts Update resolving for node_modules trace pass (#30985) 2021-11-04 20:09:37 -05:00
prerender.test.ts Handle de-duping revalidations in minimal mode (#34935) 2022-03-02 15:06:54 -08:00