Heim  >  Fragen und Antworten  >  Hauptteil

javascript - 关于使用react-hot-loader时,publicPath的问题

我在使用react-hot-loader的时候,
我的项目目录结构:

---dist
    ---js
        ---bundle.js
    ---index.html
---src
    ---js
        ---app.js

然后我在index.html里引入的是最终打包文件./js/bundle.js
我的publicPath这样写的:

/dist/js

我这样就能够正常实时刷新,但是当我不写publicPath的时候,就不能随时刷新了,请问这是怎么回事呢?这个publicPath到底有什么作用呢?
我尝试在我的index.html文件里引入:localhost:3000/dist/js/bundle.js。发现会404

另外现在我必须得输入localhost:3000/index.html才能进入这个html文件,如何配置能输入localhost:3000就直接进入呢?谢谢

巴扎黑巴扎黑2724 Tage vor299

Antworte allen(0)Ich werde antworten

Keine Antwort
  • StornierenAntwort