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

TypeError: compiler.modifiedFiles is not iterable (5.31.1) #13407

Closed
alan-agius4 opened this issue May 19, 2021 · 4 comments
Closed

TypeError: compiler.modifiedFiles is not iterable (5.31.1) #13407

alan-agius4 opened this issue May 19, 2021 · 4 comments

Comments

@alan-agius4
Copy link

alan-agius4 commented May 19, 2021

Bug report

What is the current behavior?
It appears that #13399 introduced a regression where compiler.modifiedFiles and compiler.removedFiles can now have a value of undefined, however based on the API defined in the TypeScript type definition these shouldn't be undefined

webpack/types.d.ts

Lines 1829 to 1830 in 1d2253f

modifiedFiles: Set<string>;
removedFiles: Set<string>;

Thankfully, in the Angular CLI we pin the Webpack version to a specific patch version so users aren't effect by this change, but there might users/plugins that might be effected by this change.

If the current behavior is a bug, please provide the steps to reproduce.
The bug is that compiler.modifiedFiles and compiler.removedFiles can now be undefined.

I can happily provide a reproduction, but in this case I don't think it is needed.

Related CI failure: angular/angular-cli#20844 and stack

    TypeError: compiler.modifiedFiles is not iterable
        at packages/ngtools/webpack/src/ivy/plugin.ts:208:48
        at Hook.eval (eval at create (/b/f/w/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:13:1)
        at Compiler.newCompilation (/b/f/w/node_modules/webpack/lib/Compiler.js:1030:30)
        at /b/f/w/node_modules/webpack/lib/Compiler.js:1073:29
        at Hook.eval [as callAsync] (eval at create (/b/f/w/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
        at Compiler.compile (/b/f/w/node_modules/webpack/lib/Compiler.js:1068:28)
        at /b/f/w/node_modules/webpack/lib/Watching.js:184:19
        at Hook.eval [as callAsync] (eval at create (/b/f/w/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
        at run (/b/f/w/node_modules/webpack/lib/Watching.js:138:33)
        at Watching._go (/b/f/w/node_modules/webpack/lib/Watching.js:188:3)
        at /b/f/w/node_modules/webpack/lib/Watching.js:237:12
        at /b/f/w/node_modules/webpack/lib/HookWebpackError.js:69:3
        at Hook.eval [as callAsync] (eval at create (/b/f/w/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
        at Cache.storeBuildDependencies (/b/f/w/node_modules/webpack/lib/Cache.js:122:37)
        at Watching._done (/b/f/w/node_modules/webpack/lib/Watching.js:232:25)
        at onCompiled (/b/f/w/node_modules/webpack/lib/Watching.js:142:36)
        at /b/f/w/node_modules/webpack/lib/Compiler.js:1103:17

What is the expected behavior?
The the types and actual returned value from the logic match.

Either the types are updated or the logic is updated to retain v5.31.0 behaviour were both of the above mentioned properties can never be undefined.

Other relevant information:
webpack version: 5.31.1
Node.js version: 12.20.2
Operating System: darwin x64
Additional tools: n/a

@alexander-akait
Copy link
Member

modifiedFiles can be undefined, so I think it is bug in types, not in code

@sokra
Copy link
Member

sokra commented May 19, 2021

modifiedFiles is always undefined in the initial compilation. We need to fix the typings.

But in your case it actually shouldn't be undefined. We need to fix that too.

@alan-agius4
Copy link
Author

@sokra , indeed in this case it does need to be defined.

@alan-agius4
Copy link
Author

Fixed in 5.38.0

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

No branches or pull requests

4 participants