in packages/docpack-page-generator/lib/plugin.js [59:87]
PageGeneratorPlugin.prototype.configure = function(compiler) {
var config = this.config;
var tpl = config.template;
var tplExt = path.extname(tpl);
var tplAbsPath = path.resolve(tpl);
var resolveExtensions = compiler.options.resolve.extensions;
var moduleOptions = compiler.options.module;
var hasLoadersToProcessTemplate = resolveExtensions.indexOf(tplExt) >= 0 || tools.getMatchedLoaders(moduleOptions, tplAbsPath).length > 0;
var loadersProp = tools.getWebpackVersion(true) >= '2' ? 'rules' : 'loaders';
if (!Array.isArray(moduleOptions[loadersProp])) {
moduleOptions[loadersProp] = [];
}
// If loader specified explicitly, add it to config
if (config.loader) {
moduleOptions[loadersProp].push(config.loader);
}
else if (!hasLoadersToProcessTemplate) {
// If no loaders to process the template - add fallback loader to config
moduleOptions[loadersProp].push({
test: new RegExp('\\.' + tplExt.substr(1) + '$'),
loader: require.resolve(CONST.FALLBACK_LOADER_NAME),
include: path.dirname(tplAbsPath)
});
}
};