B
B
beDenz2020-10-31 09:41:52
webpack
beDenz, 2020-10-31 09:41:52

VueLoaderPlugin and run function in file handling rules?

Good afternoon. I ran into a problem when creating a assembler bundle for my projects. I need to get information about the file that is transferred to the loader, for this I write a rule:

{
    test: XXXX, // разрешение файла
    (data) => {
         // какой-то код
    }
}


And everything works great. But after I connect the vue-loader, this code stops working: there are no errors, the bundle is built, that the dev server, that the pro build, webpack just ignores those loaders where I want to run the function, and just inserts it as it is, without processing. I remove new VueLoaderPlugin () from the array of plugins - everything works as it should, only vue falls off))

I would be grateful if someone tells me where to dig.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
beDenz, 2020-11-02
@beDenz

I started to analyze the loader sources - it turned out that it clones and rewrites all the rules, and in the process all declared functions were thrown out. But there was one exception, if the enforce property was set, then this rule was not processed. Regardless of the enforce value set, the functions began to work as intended.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question