Answer the question
In order to leave comments, you need to log in
How to write a plugin to insert your files into the build code?
There is a file with some content, you need to insert it into the final js code using the import / require command, but when you insert it, you need to convert it. How to write a plugin for this under Vue Cli 3?
psOf course, you can insert "as is" and then convert it, but I don't want to insert unnecessary data into the code.
Answer the question
In order to leave comments, you need to log in
We write such a plugin file
module.exports = function (source) {
// Судя по всему нужно для кеширования
if (this.cacheable) this.cacheable();
// Трансформация данных файла source
...
// Вернуть трансформированные данные
return source;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question