React for Beginners - Episode 3 - Adding assets to your isomorphic application (using webpack…
Valerii Iatsko
732

With the change on the javascript pack filename to:

`filename: ‘[name]-[hash].js’`

I think it’s also necessary to update the script src attribute in default.jsx.

<script
 src={
 process.env.NODE_ENV === ‘development’ ?
 `http://${webpackHost}:${webpackPort}/assets/main.js` :
 ‘/assets/main.js’
 }
 charSet="UTF-8"
 />

I ended up changing it to the following (but I could be missing something? Should it be different when not in development?):

<script
 src={ assets.javascript.main }
 charSet=”UTF-8"
 />

(I’m really new to React and couldn’t figure out why my onClicks weren’t working properly until I noticed that my app was unable to load ‘main.js’. Thanks for the tutorial! It has been extremely helpful.)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.