Skip to content

Commit

Permalink
chore: remove unsless @ts-ignore (vercel#40992)
Browse files Browse the repository at this point in the history
## 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)
  • Loading branch information
fireairforce authored and BowlingX committed Oct 5, 2022
1 parent e842c1c commit 592aad3
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 21 deletions.
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
2 changes: 0 additions & 2 deletions packages/next/build/webpack/plugins/build-manifest-plugin.ts
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
2 changes: 0 additions & 2 deletions packages/next/build/webpack/plugins/pages-manifest-plugin.ts
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
2 changes: 0 additions & 2 deletions packages/next/build/webpack/plugins/react-loadable-plugin.ts
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

0 comments on commit 592aad3

Please sign in to comment.