react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

index.html has broken path to assets/app.js #233

Closed tylerjryan closed 3 months ago

tylerjryan commented 8 years ago

In src/index.html, the app.js file is sourced by this line here:

  <script type="text/javascript" src="/assets/app.js"></script>

When opening the dist/index.html file after running npm run dist, I am seeing this error in the console:

Failed to load resource: net::ERR_FILE_NOT_FOUND ...  file:///assets/app.js

I fixed this by simply changing the src path to:

  <script type="text/javascript" src="./assets/app.js"></script>

Notice the addition of the "." in front of /assets.

weblogixx commented 8 years ago

HI @tylerjryan,

we just changed the path of assets/app.js to be absolute instead of relative. This is needed because when using react router with deep routes, app.js cannot be found. I will have a look at how to fix this for both dev and live versions.

tylerjryan commented 8 years ago

Thank you!