GoogleChromeLabs / worker-plugin

👩‍🏭 Adds native Web Worker bundling support to Webpack.
https://npm.im/worker-plugin
Apache License 2.0
1.91k stars 79 forks source link

entries[0].files.values is not a function #108

Open selmalee opened 3 years ago

selmalee commented 3 years ago

this error occurs:

[1] (node:27264) UnhandledPromiseRejectionWarning: TypeError: entries[0].files.values is not a function
[1] at xxx/node_modules/worker-plugin/dist/loader.js:86:59
[1] at compile (xxx/node_modules/webpack/lib/Compiler.js:343:11)
[1] at hooks.afterCompile.callAsync.err (xxx/node_modules/webpack/lib/Compiler.js:681:15)
[1] at AsyncSeriesHook.eval [as callAsync] (eval at create (xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
[1] at AsyncSeriesHook.lazyCompileHook (xxx/node_modules/tapable/lib/Hook.js:154:20)
[1] at compilation.seal.err (xxx/node_modules/webpack/lib/Compiler.js:678:31)
[1] at AsyncSeriesHook.eval [as callAsync] (eval at create (xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[1] at AsyncSeriesHook.lazyCompileHook (xxx/node_modules/tapable/lib/Hook.js:154:20)
[1] at hooks.optimizeAssets.callAsync.err (xxx/node_modules/webpack/lib/Compilation.js:1423:35)
[1] at AsyncSeriesHook.eval [as callAsync] (eval at create (xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[1] at AsyncSeriesHook.lazyCompileHook (xxx/node_modules/tapable/lib/Hook.js:154:20)
[1] at hooks.optimizeChunkAssets.callAsync.err (xxx/node_modules/webpack/lib/Compilation.js:1414:32)
[1] at _promise0.then._result0 (eval at create (xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
[1] at <anonymous>

.values is unsupported in Node versions below 8. So, I suggest .valuesshould be replaced by

var vals = Object.keys(countries).map(function(key) {
    return countries[key];
});