在react项目中使用webpack打包后点击index.html页面控制台提示Failed to load resource: net::ERR_FILE_NOT_FOUND的解决方法
方法一:在package.json文件中进行如下修改
"homepage":"./"
{
"name": "cnode",
"version": "1.0.0",
"description": "",
"main": "index.js",
"homepage":"./",
"author": "",
"license": "ISC",
}
方法二:在webpack.config.js文件中进行如下修改
publicPath: "./"
module.exports = {
···
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].[hash].js',
publicPath: "./"
}
···
}