Support Webpack 5 by updating VirtualModulesPlugin from upstream #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tl;dr: Webpack 5 support, fixes
TypeError: Cannot read property 'data' of undefined
This updates the internal VirtualModulesPlugin, which is copied from
webpack-virtual-modules
, which was originally added by @kaisermann. These changes allow for using Webpack 5 withsvelte-loader
. The changes of #125, which have also been fixed upstream, have been preserved. See #59 (comment) for the background on why the source code is just copied over instead of added as a dependency. Due to thesvelte-loader
specific changes already invirtual.js
, I have manually gone through the commit history ofwebpack-virtual-modules
and applied relevant changes instead of just copy-pasting the new source code. There is also a small change toindex.js
to prevent the error handling code from itself throwing errors, since that was causing some (now fixed) troubles when debugging my changes.This also adds in the literal text of the license of
webpack-virtual-modules
, since "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software".Tests and lints pass, and I have verified this works with both Webpack 4 and Webpack 5.