in packages/next/plugin-webpack5-os/src/OSJsonpPlugin.ts [36:59]
private wrappChunks(compiler: Compiler, compilation: Compilation, assets: Compilation['assets']) {
Object.entries(assets).forEach(([id, asset]) => {
if (!id.endsWith('.js')) return;
if (
this.option.ignoreFilenames?.find(
(strOrReg) => {
if (typeof strOrReg === 'string') return strOrReg === id;
if (strOrReg instanceof RegExp) return strOrReg.test(id);
return false;
},
)
) {
return;
}
const code = asset.source().toString();
const [prefix, suffix] = this._wrapCodeWithOSJsonp(this.option.id || this.getId(compiler));
// @ts-ignore
compilation.assets[id] = new ConcatSource(prefix, code, suffix);
});
}