在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: "./" 
    }
    ···
}

原文链接:https://blog.csdn.net/weixin_39893889/article/details/102462912

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《在react项目中使用webpack打包后点击index.html页面控制台提示Failed to load resource: net::ERR_FILE_NOT_FOUND的解决方法
   

还没有人抢沙发呢~