-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnext.ts
36 lines (31 loc) · 1.13 KB
/
next.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { type NextConfig } from "next";
import { withHydrationOverlayWebpack } from "./webpack.js";
export type NextPluginOptions = {
/**
* The selector for the root element of your app. Defaults to `#__next`.
*/
appRootSelector?: string;
};
const withHydrationOverlay =
(pluginOptions: NextPluginOptions = {}) =>
(nextConfig: NextConfig = {}): NextConfig => {
const extraConfig: NextConfig = {
webpack(config, ctx) {
if (!ctx.dev) {
console.warn(
"[ReactHydrationOverlay]: This plugin is only meant to be used in development mode. Please remove it from your next.config.js."
);
}
return withHydrationOverlayWebpack({
appRootSelector: pluginOptions.appRootSelector || "#__next",
isMainAppEntryPoint: (entryPointName: string) =>
!ctx.isServer &&
(entryPointName === "pages/_app" ||
// entrypoint for `/app` pages
entryPointName === "main-app"),
})(config);
},
};
return Object.assign({}, nextConfig, extraConfig);
};
export { withHydrationOverlayWebpack, withHydrationOverlay };