Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: times is not iterable bug #1290

Closed
wants to merge 1 commit into from
Closed

Conversation

elf-mouse
Copy link

No description provided.

@johnnyreilly
Copy link
Member

Under what circumstances would compiler.fileTimestamps not be present?

@elf-mouse
Copy link
Author

elf-mouse commented Apr 23, 2021

For webpack@5 middlewares usage:

const webpack = require('webpack');
const middleware = require('webpack-dev-middleware');
const compiler = webpack({
  // webpack options
});

console.log(compiler.fileTimestamps);
// Output:
// webpack@4: Map(0) {}
// webpack@5: undefined

@johnnyreilly
Copy link
Member

johnnyreilly commented Apr 23, 2021

Interesting - has compiler.fileTimestamps been replaced by something else in webpack 5?

cc @sokra @alexander-akait

@sokra
Copy link
Contributor

sokra commented Apr 23, 2021

Yes with FileSystemInfo and the snapshot system.

Avoid comparing timestamps directly and use a snapshot instead

@johnnyreilly
Copy link
Member

Yes with FileSystemInfo and the snapshot system.

Avoid comparing timestamps directly and use a snapshot instead

@elf-mouse would you care to take a look at @sokra's suggestion around migrating to use these APIs instead?

This feels like a better approach.

@elf-mouse
Copy link
Author

Hi @johnnyreilly ,

It is recommended to update the patch first to fix this bug to ensure online security.

I would migrate to use new APIs when I have time later.

THX~

@johnnyreilly
Copy link
Member

Thanks @elf-mouse - but I'm not very keen on the current workaround; going for the new APIs feels like the better approach.

@kaytrance
Copy link

do I understand correctly that the only workaround for now is not to use webpack 5?

@johnnyreilly
Copy link
Member

johnnyreilly commented May 22, 2021

If someone would like to create a minimal reproduction repo that illustrates this issue, it might help people to work on this.

@ghost
Copy link

ghost commented Dec 8, 2021

If someone would like to create a minimal reproduction repo that illustrates this issue, it might help people to work on this.

There is a simple example:
https://stackoverflow.com/questions/67699117/error-when-trying-to-run-dev-server-react-ssr

Any progress in fixing this issue?

@imdavidmin
Copy link

This error seems to have popped out of nowhere for me. Have been using Next / webpack 5 for a while and previously compiled fine.

@johnnyreilly
Copy link
Member

If someone would like to submit a PR which makes use of the advice provided by @sokra we'll happily take a look:

Yes with FileSystemInfo and the snapshot system.

Avoid comparing timestamps directly and use a snapshot instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants