Issue 1:
Bug report

What is the current behavior?

As defined in TypeScript, the fs.stat in Node.js returns value of type Stats | BigIntStats. While in Webpack's type definition, the API InputFileSystem.stat returns value of type IStats, which is not assignable to Stats | BigIntStats.

This becomes a problem for me. I'm using fast-glob, and its sync API offers an fs option. However, I can't assign the LoaderContext.fs to this option.

If the current behavior is a bug, please provide the steps to reproduce.

Create index.ts with the following content:

import { sync } from 'fast-glob'
import { LoaderContext } from 'webpack';

function testFunc(fs: LoaderContext<any>['fs']) {
sync('source', { fs: {
stat: fs.stat
} });
}

And compile with tsc:

➜ tsc index.ts
index.ts:6:9 - error TS2769: No overload matches this call.
Overload 1 of 2, '(source: string | string[], options: Options & EntryObjectPredicate): Entry[]', gave the following error.
Type '(arg0: string, arg1: (arg0?: ErrnoException, arg1?: IStats) => void) => void' is not assignable to type 'StatAsynchronousMethod'.
Types of parameters 'arg1' and 'callback' are incompatible.
Types of parameters 'stats' and 'arg1' are incompatible.
Type 'IStats' is not assignable to type 'Stats | BigIntStats'.
Type 'IStats' is not assignable to type 'BigIntStats'.
Property 'atimeNs' is optional in type 'IStats' but required in type 'BigIntStats'.
Overload 2 of 2, '(source: string | string[], options?: Options): string[]', gave the following error.
Type '(arg0: string, arg1: (arg0?: ErrnoException, arg1?: IStats) => void) => void' is not assignable to type 'StatAsynchronousMethod'.

6 stat: fs.stat
~~~~

node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts:8:5
8 stat: StatAsynchronousMethod;
~~~~
The expected type comes from property 'stat' which is declared here on type 'Partial<FileSystemAdapter>'
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts:8:5
8 stat: StatAsynchronousMethod;
~~~~
The expected type comes from property 'stat' which is declared here on type 'Partial<FileSystemAdapter>'

Found 1 error.

What is the expected behavior?

The code snippet above should compile without any type errors.

Other relevant information:

webpack version: 5.50.0

Node.js version: 14.15.1

Operating System: macOS Big Sur 11.5.2

Additional tools:

Issue 2:
🎄 First, thanks for trying and giving feedback to our alpha version. 🎄

Note that it's still in an early state and stuff may be broken. This is something you want to report here, as we don't want this to happen in the final release.

Note that the major version has breaking changes and some plugins might no longer work as expected. We try to provided compatibility layers when possible, but some of the changes make this difficult (especially regarding injection additional runtime code). If some plugin isn't working this is also something you should report here to we are at least aware of it and may work on fixing it or adding a compatibility layer.

Here is the full Changelog. Make sure to read at least until the configuration changes to be up-to-date.

If you find something missing in the changelog, this is also something to report here. Easy fixes can made directly in the repo. Every webpack contributor has write access, otherwise send a PR.

If everything is working great, that's also nice to hear. If you are trying the Persistent Caching feature, we would love to see numbers.

Please make sure to try with the lastest alpha version before reporting, as it may already be fixed. You can use the npm dist-tag next to reference the latest alpha version.

package.json "webpack": "next". Update with yarn upgrade webpack / npm update webpack.

Not to forget: Thanks for everybody contributed to this version (@byzyk, @cacheflow, @Connormiha, @fscherwi, @guybedford, @michael-ciniawsky, @niieani, @ooflorent, @SevInf, @smelukov, @sodatea, @sokra, @xtuc). 🎉

Feedback summary:

mini-css-extract-plugin is incompatible (RuntimeModules change)

fork-ts-checker-webpack-plugin is incompatible (frozen hooks)

circular-dependency-plugin is incompatible (dep.module removed)

cache-loader is no longer needed

webpack-cli misses Stats.presetToOptions (should use compilation.createStatsOptions)

html-webpack-plugin misses fileTimestamps (should use fileSystemInfo)

null prototype objects can't be serialized

Deprecation warning for the HMR defaults

Docs need update

namedChunkGroups have weird keys

MultiStats.toJson fails without options argument (#8561)

Stats assetsByChunkName is different to v4

node.global: false causes many errors

define is missing require requirement for module

reasons for scope-hoisted modules are inconsistent

resolve.alias false doesn't work

Source map caching is very slow

Runtime modules duplicated in runtime chunk single

Compilation.rebuildModule broken in alpha