Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unsless @ts-ignore #40992

Merged
merged 3 commits into from Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,7 +45,6 @@ export class AppBuildManifestPlugin {
compilation.hooks.processAssets.tap(
{
name: PLUGIN_NAME,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => this.createAsset(assets, compilation)
Expand Down
Expand Up @@ -266,11 +266,9 @@ export default class BuildManifestPlugin {

apply(compiler: webpack.Compiler) {
compiler.hooks.make.tap('NextJsBuildManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsBuildManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/next/build/webpack/plugins/copy-file-plugin.ts
Expand Up @@ -35,7 +35,6 @@ export class CopyFilePlugin {
hook.tapPromise(
{
name: PLUGIN_NAME,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
async () => {
Expand Down Expand Up @@ -69,7 +68,6 @@ export class CopyFilePlugin {
})
}

// @ts-ignore
compilation.emitAsset(file, source, {
...this.info,
})
Expand Down
Expand Up @@ -60,7 +60,6 @@ export class CssMinimizerPlugin {
compilation.hooks.processAssets.tapPromise(
{
name: 'CssMinimizerPlugin',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
},
async (assets: any) => {
Expand Down
Expand Up @@ -255,11 +255,9 @@ export class FontStylesheetGatheringPlugin {
})

compiler.hooks.make.tap(this.constructor.name, (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: this.constructor.name,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
Expand Down
Expand Up @@ -18,7 +18,6 @@ export class DropClientPage implements webpack.WebpackPluginInstance {
function findEntryModule(mod: any): webpack.Module | null {
const queue = new Set([mod])
for (const module of queue) {
// @ts-ignore TODO: webpack 5 types
const incomingConnections =
compilation.moduleGraph.getIncomingConnections(module)

Expand Down Expand Up @@ -73,11 +72,9 @@ export class DropClientPage implements webpack.WebpackPluginInstance {
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
for (const [name, entryData] of compilation.entries) {
for (const dependency of entryData.dependencies) {
// @ts-ignore TODO: webpack 5 types
const module = compilation.moduleGraph.getModule(dependency)
if (module?.buildInfo?.NEXT_ampFirst) {
ampFirstEntryNamesItem.push(name)
// @ts-ignore @types/webpack has outdated types for webpack 5
compilation.entries.delete(name)
}
}
Expand Down
Expand Up @@ -466,11 +466,9 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
'next-trace-entrypoint-plugin'
)
traceEntrypointsPluginSpan.traceFn(() => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tapAsync(
{
name: PLUGIN_NAME,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
},
(assets: any, callback: any) => {
Expand Down
Expand Up @@ -127,11 +127,9 @@ export default class PagesManifestPlugin

apply(compiler: webpack.Compiler): void {
compiler.hooks.make.tap('NextJsPagesManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsPagesManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
Expand Down
Expand Up @@ -187,11 +187,9 @@ export class ReactLoadablePlugin {

apply(compiler: webpack.Compiler) {
compiler.hooks.make.tap('ReactLoadableManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'ReactLoadableManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/next/build/webpack/plugins/serverless-plugin.ts
Expand Up @@ -14,22 +14,18 @@ export class ServerlessPlugin {
hook.tap('ServerlessPlugin', (chunks) => {
for (const chunk of chunks) {
// If chunk is not an entry point skip them
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
if (compilation.chunkGraph.getNumberOfEntryModules(chunk) === 0) {
continue
}

// Async chunks are usages of import() for example
const dynamicChunks = chunk.getAllAsyncChunks()
for (const dynamicChunk of dynamicChunks) {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
for (const module of compilation.chunkGraph.getChunkModulesIterable(
dynamicChunk
)) {
// Add module back into the entry chunk
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
if (!compilation.chunkGraph.isModuleInChunk(module, chunk)) {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.chunkGraph.connectChunkAndModule(chunk, module)
}
}
Expand Down