Error: Cannot find module 'url-loader'at Function.Module._resolveFilename (module.js:555:15)at Function.resolve (internal/module.js:18:19)at Object.<anonymous> (F:\react-webpack\webpack.config.js:33:25)at Module._compile (module.js:660:30)at Object.Module._extensions..js (module.js:671:10)at Module.load (module.js:573:32)at tryModuleLoad (module.js:513:12)at Function.Module._load (module.js:505:3)at Module.require (module.js:604:17)at require (internal/module.js:11:18)npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! react-webpack@1.0.0 server: webpack-dev-server --opennpm ERR! Exit status 1npm ERR!npm ERR! Failed at the react-webpack@1.0.0 server script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR! C:UsersAdministratorAppDataRoamingnpm-cache_logs2018-03-20T01_27_55_831Z-debug.logF:react-webpack>这是报的错误var path =require('path');module.exports = {//入口文件entry:'./app/index.js',//出口文件output:{ filename:'index.js', path:path.resolve(__dirname,'dist'), publicPath:'temp/' },devServer:{ contentBase:'./', host:'localhost', compress:true, port:1717},// module:{// loaders:[// {// test:/.js$/,// exclude:/node_modules/,// loaders:"babel-loader",// query:{// presets:['es2015','react']// }// }// ]// }module: {rules: [ { test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], loader: require.resolve('url-loader'), options: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]', }, },]}这是webpack.config.js 文件,这个文件应该配置有错误,那个大神,还是错误呢
1 回答
阿晨1998
TA贡献2037条经验 获得超6个赞
module不是这样配置的
module: {
rules: [
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
},
},
]
}
第一层元素是rules
添加回答
举报
0/150
提交
取消
