本文主要是介绍报错Error: options/query provided without loader (use loader + options) in {,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
首先贴报错:
webpack配置如下:
module.exports = {entry: {app: './src/index.js',search: './src/search.js'},output: {path: path.resolve(__dirname, 'dist'),filename: '[name].[chunkhash:8].js'},mode:'development',module: {rules: [{test: /.(woff|woff2|eot|ttf|otf)$/,use: 'file-loader',options: {name: '[name][hash:8].[ext]'}}]}
}
这里面我配置了字体(或者图片)的hash配置:
options: { name: '[name][hash:8].[ext]'}
报错是说options没有提供一个loader去配置name,大致的意思。
解决方案:
{test: /.(woff|woff2|eot|ttf|otf)$/,// use: 'file-loader',// options: {// name: 'img/[name][hash:8].[ext]'// }use: [{loader: 'file-loader',query: {name: '[name].[hash:8].[ext]'}}]
}
这篇关于报错Error: options/query provided without loader (use loader + options) in {的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!