diff --git a/packages/next/build/webpack/plugins/app-build-manifest-plugin.ts b/packages/next/build/webpack/plugins/app-build-manifest-plugin.ts index 64567f193bd2..8eebd3228377 100644 --- a/packages/next/build/webpack/plugins/app-build-manifest-plugin.ts +++ b/packages/next/build/webpack/plugins/app-build-manifest-plugin.ts @@ -31,12 +31,12 @@ export class AppBuildManifestPlugin { PLUGIN_NAME, (compilation: any, { normalModuleFactory }: any) => { compilation.dependencyFactories.set( - (webpack as any).dependencies.ModuleDependency, + webpack.dependencies.ModuleDependency, normalModuleFactory ) compilation.dependencyTemplates.set( - (webpack as any).dependencies.ModuleDependency, - new (webpack as any).dependencies.NullDependency.Template() + webpack.dependencies.ModuleDependency, + new webpack.dependencies.NullDependency.Template() ) } ) diff --git a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts index 4f4e74429e91..ff43c478d751 100644 --- a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts @@ -1,16 +1,17 @@ +import type { + CssImports, + ClientComponentImports, + NextFlightClientEntryLoaderOptions, +} from '../loaders/next-flight-client-entry-loader' +import { webpack } from 'next/dist/compiled/webpack/webpack' import { stringify } from 'querystring' import path from 'path' -import { webpack, sources } from 'next/dist/compiled/webpack/webpack' +import { sources } from 'next/dist/compiled/webpack/webpack' import { getInvalidator, entries, EntryTypes, } from '../../../server/dev/on-demand-entry-handler' -import type { - CssImports, - ClientComponentImports, - NextFlightClientEntryLoaderOptions, -} from '../loaders/next-flight-client-entry-loader' import { APP_DIR_ALIAS, WEBPACK_LAYERS } from '../../../lib/constants' import { APP_CLIENT_INTERNALS, @@ -52,12 +53,12 @@ export class FlightClientEntryPlugin { PLUGIN_NAME, (compilation, { normalModuleFactory }) => { compilation.dependencyFactories.set( - (webpack as any).dependencies.ModuleDependency, + webpack.dependencies.ModuleDependency, normalModuleFactory ) compilation.dependencyTemplates.set( - (webpack as any).dependencies.ModuleDependency, - new (webpack as any).dependencies.NullDependency.Template() + webpack.dependencies.ModuleDependency, + new webpack.dependencies.NullDependency.Template() ) } ) @@ -464,8 +465,8 @@ export class FlightClientEntryPlugin { clientComponentImports, bundlePath, }: { - compiler: any - compilation: any + compiler: webpack.Compiler + compilation: webpack.Compilation entryName: string clientComponentImports: ClientComponentImports bundlePath: string @@ -524,11 +525,12 @@ export class FlightClientEntryPlugin { } // Inject the entry to the server compiler (__sc_client__). - const clientComponentEntryDep = ( - webpack as any - ).EntryPlugin.createDependency(clientSSRLoader, { - name: bundlePath, - }) + const clientComponentEntryDep = webpack.EntryPlugin.createDependency( + clientSSRLoader, + { + name: bundlePath, + } + ) // Add the dependency to the server compiler. await this.addEntry( @@ -552,8 +554,8 @@ export class FlightClientEntryPlugin { addEntry( compilation: any, context: string, - dependency: any /* Dependency */, - options: any /* EntryOptions */ + dependency: webpack.Dependency, + options: webpack.EntryOptions ): Promise /* Promise */ { return new Promise((resolve, reject) => { const entry = compilation.entries.get(options.name) diff --git a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts index 1e63e4a4dece..70ae2c3ac04a 100644 --- a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts @@ -96,12 +96,12 @@ export class FlightManifestPlugin { PLUGIN_NAME, (compilation, { normalModuleFactory }) => { compilation.dependencyFactories.set( - (webpack as any).dependencies.ModuleDependency, + webpack.dependencies.ModuleDependency, normalModuleFactory ) compilation.dependencyTemplates.set( - (webpack as any).dependencies.ModuleDependency, - new (webpack as any).dependencies.NullDependency.Template() + webpack.dependencies.ModuleDependency, + new webpack.dependencies.NullDependency.Template() ) } ) diff --git a/packages/next/build/webpack/plugins/middleware-plugin.ts b/packages/next/build/webpack/plugins/middleware-plugin.ts index 14688a0932a4..73c061d51bde 100644 --- a/packages/next/build/webpack/plugins/middleware-plugin.ts +++ b/packages/next/build/webpack/plugins/middleware-plugin.ts @@ -861,7 +861,7 @@ export default class MiddlewarePlugin { compilation.hooks.processAssets.tap( { name: 'NextJsMiddlewareManifest', - stage: (webpack as any).Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, + stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS, }, getCreateAssets({ compilation,