Answer the question
In order to leave comments, you need to log in
How to tell webpack to use only ONE loader?
I specify my loader
However, this loader generates javascript code, which, as I understand it, is then further converted. But webpack thinks that since the extension is .json, it means json is being generated there and trying to do something else with it. it is obvious to use some other bootloader.
Question: can I somehow specify that I need to apply only my loader and do nothing else?
import "!./../my-loader!./../../package.json";
Answer the question
In order to leave comments, you need to log in
I found this hack to change the type from json to javascript
const requiredType = 'javascript/auto';
const factory = this._compilation.dependencyFactories.get(LoaderDependency);
this._module.type = requiredType;
this._module.generator = factory.getGenerator(requiredType);
this._module.parser = factory.getParser(requiredType);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question