Unverified Commit 78cb07a4 authored by zoomdong's avatar zoomdong Committed by GitHub

chore: remove unsless @ts-ignore (#40992)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Errors have a helpful link attached, see `contributing.md`

## Feature

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

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent fa19f172
......@@ -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)
......
......@@ -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) => {
......
......@@ -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 () => {
......@@ -69,7 +68,6 @@ export class CopyFilePlugin {
})
}
// @ts-ignore
compilation.emitAsset(file, source, {
...this.info,
})
......
......@@ -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) => {
......
......@@ -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) => {
......
......@@ -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)
......@@ -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)
}
}
......
......@@ -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) => {
......
......@@ -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) => {
......
......@@ -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) => {
......
......@@ -14,7 +14,6 @@ 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
}
......@@ -22,14 +21,11 @@ export class ServerlessPlugin {
// 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)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment