当地址栏为http://localhost:3030/articles
时index.html引入的路径为http://localhost:3030/dist/js/bundle.js
;
当地址栏变为http://localhost:3030/articles/1
时,此时刷新一下页面index.html引入的路径就变为http://localhost:3030/articles/dist/js/bundle.js
了
这种情况下页面就无法加载了,所以这是要如何解决?
webpack的publicPath配置如下
index.html的引入如下
publicPath开头加上斜杠