Skip to content

Commit

Permalink
fix: install vfs plugin when load is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 27, 2021
1 parent 9945b37 commit a33bbe3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function getWebpackPlugin<UserOptions = {}> (
if (plugin.resolveId) {
const virtualModule = new VirtualModulesPlugin()
plugin.__vfs = virtualModule
compiler.options.plugins.push(virtualModule)

const resolver = {
apply (resolver: Resolver) {
Expand Down Expand Up @@ -110,6 +109,10 @@ export function getWebpackPlugin<UserOptions = {}> (

// load hook
if (plugin.load) {
if (plugin.__vfs) {
compiler.options.plugins.push(plugin.__vfs)
}

compiler.options.module.rules.push({
include () {
return true
Expand Down

0 comments on commit a33bbe3

Please sign in to comment.