webpack(自动打包)页面报错CannotGET/
安装webpack自动打包工具以后,也配置完毕,但是打开页面以后显示的是:
解决办法:
在webpack.config.js
文件中module.exports
对象下添加以下代码即可:
module.exports={//设置打包模式mode:'development',//修改默认打包路径entry:path.join(__dirname,'./src/index.js'),output:{path:path.join(__dirname,'./dist'),filename:'bundle.js'},//添加以下代码:devServer:{static:{directory:path.join(__dirname,'./'),watch:true}}}