Skip to content

Commit

Permalink
change to use .entries
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Oct 16, 2022
1 parent 200f17d commit 8e175bc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/next/build/webpack/plugins/flight-types-plugin.ts
Expand Up @@ -3,8 +3,6 @@ import path from 'path'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import { WEBPACK_LAYERS } from '../../../lib/constants'

import { traverseModules } from '../utils'

const PLUGIN_NAME = 'FlightTypesPlugin'

interface Options {
Expand Down Expand Up @@ -77,8 +75,10 @@ export class FlightTypesPlugin {
? '..'
: path.join('..', '..')

const handleModule = (mod: webpack.NormalModule, assets: any) => {
if (mod.layer !== WEBPACK_LAYERS.server) return
const handleModule = (_mod: webpack.Module, assets: any) => {
if (_mod.layer !== WEBPACK_LAYERS.server) return
const mod: webpack.NormalModule = _mod as any

if (!mod.resource) return
if (!mod.resource.startsWith(this.appDir + path.sep)) return
if (!/\.(js|jsx|ts|tsx|mjs)$/.test(mod.resource)) return
Expand Down Expand Up @@ -123,9 +123,9 @@ export class FlightTypesPlugin {
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,
},
(assets) => {
traverseModules(compilation, (mod) => {
for (const mod of compilation.modules) {
handleModule(mod, assets)
})
}
}
)
})
Expand Down

0 comments on commit 8e175bc

Please sign in to comment.