有以下加载程序配置:
{
test: /\.(png|svg)$/,
include: projectBasePath + '/src/app/assets/images/favicons',
loader: 'file?name=' + defaultPublicImagesPath + 'favicons/' + '[name].[ext]'
}
projectBasePath
和defaultPublicImagesPath
是一些路径变量,它们中没有错误。有一些文件需要图像:
require('app/assets/images/favicons/favicon-16x16.png');
require('app/assets/images/favicons/favicon-32x32.png');
require('app/assets/images/favicons/apple-touch-icon.png');
require('app/assets/images/favicons/safari-pinned-tab.svg');
require('app/assets/images/favicons/android-chrome-192x192.png');
require('app/assets/images/favicons/mstile-70x70.png');
require('app/assets/images/favicons/mstile-144x144.png');
require('app/assets/images/favicons/mstile-150x150.png');
require('app/assets/images/favicons/mstile-310x150.png');
require('app/assets/images/favicons/mstile-310x310.png');
但是当我尝试使用webpack进行构建时,我得到的错误是这些图像没有加载器。我该如何解决?
答案 0 :(得分:-1)
您需要安装webpack的文件加载器才能使用它。使用以下命令安装它:
npm install file-loader --save-dev