rmarscher / virtual-module-webpack-plugin

Adds the contents of a virtual file to webpack's cached file system without writing it to disk
174 stars 17 forks source link

Fix resolver returning undefined arguments to cb() #13

Closed WillsonHaw closed 7 years ago

WillsonHaw commented 7 years ago

Currently, when resolving the resolved promise, the arguments passed to cb contains an argument with undefined as the first argument, like so:

image

This causes an issue with the enhanced-resolver in webpack. Particularly this line here: https://github.com/webpack/enhanced-resolve/blob/master/lib/Resolver.js#L128

Because arguments.length is > 0, this causes the callback to be called, instead of the resolver.applyPluginsAsyncSeriesBailResult1 being called, which means after-resolve never gets called in the plugin chain, causing other things in webpack to break.

This fix just makes sure cb() gets called with no arguments.

rmarscher commented 7 years ago

Great. LGTM. Thanks for this.

rmarscher commented 7 years ago

Published to NPM in version 0.2.2.