silverwolf-x's picture
download
raw
1.32 kB
import type { webpack } from 'next/dist/compiled/webpack/webpack'
import { getModuleBuildError } from './webpackModuleError'
const NAME = 'WellKnownErrorsPlugin'
export class WellKnownErrorsPlugin {
apply(compiler: webpack.Compiler) {
compiler.hooks.compilation.tap(NAME, (compilation) => {
compilation.hooks.afterSeal.tapPromise(NAME, async () => {
if (compilation.warnings?.length) {
await Promise.all(
compilation.warnings.map(async (warn, i) => {
if (
warn.name === 'ModuleDependencyWarning' &&
warn.module?.context?.includes('node_modules')
) {
compilation.warnings.splice(i, 1)
}
})
)
}
if (compilation.errors?.length) {
await Promise.all(
compilation.errors.map(async (err, i) => {
try {
const moduleError = await getModuleBuildError(
compiler,
compilation,
err
)
if (moduleError !== false) {
compilation.errors[i] = moduleError
}
} catch (e) {
console.log(e)
}
})
)
}
})
})
}
}

Xet Storage Details

Size:
1.32 kB
·
Xet hash:
d5305b6bdb9508c3e6f562ab21c3e437dc013455ddaaafb45a46e506b77390e9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.